Skip to content

Commit

Permalink
fix: 🐛 修复Form组件rules属性,没有按照顺序执行问题 (#808)
Browse files Browse the repository at this point in the history
* fix: 修复Form组件rules属性,没有按照顺序执行问题 (#799)

* Revert "fix: 修复Form组件rules属性,没有按照顺序执行问题 (#799)"

This reverts commit fc7609f.

* fix: 修复Form组件rules属性,没有按照顺序执行问题 (#799)
  • Loading branch information
GNaIq-GnAw authored Jan 6, 2025
1 parent 04e9a50 commit 834cd8e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ function getMergeRules() {
}
function showMessage(errors: ErrorMessage[]) {
const messages = errors.filter((error) => error.message)
const childrenProps = children.map((e) => e.prop).filter(Boolean)
const messages = errors.filter((error) => error.message && childrenProps.includes(error.prop))
if (messages.length) {
messages.sort((a, b) => {
return childrenProps.indexOf(a.prop) - childrenProps.indexOf(b.prop)
})
if (props.errorType === 'toast') {
showToast(messages[0].message)
} else if (props.errorType === 'message') {
Expand Down

0 comments on commit 834cd8e

Please sign in to comment.