Skip to content

Commit

Permalink
fix(element-components): fix formitem feedback msg (#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfore authored Mar 3, 2022
1 parent a372244 commit 8d20177
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/element/src/form-item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,19 +503,11 @@ const Item = connect(
if (isVoidField(field)) return props
if (!field) return props
const takeMessage = () => {
const split = (messages: any[]) => {
return messages.reduce((buf, text, index) => {
if (!text) return buf
return index < messages.length - 1
? buf.concat([text, ', '])
: buf.concat([text])
}, [])
}
if (field.validating) return
if (props.feedbackText) return props.feedbackText
if (field.selfErrors.length) return split(field.selfErrors)
if (field.selfWarnings.length) return split(field.selfWarnings)
if (field.selfSuccesses.length) return split(field.selfSuccesses)
if (field.selfErrors.length) return field.selfErrors
if (field.selfWarnings.length) return field.selfWarnings
if (field.selfSuccesses.length) return field.selfSuccesses
}
const errorMessages = takeMessage()
return {
Expand Down

0 comments on commit 8d20177

Please sign in to comment.