Skip to content

Commit

Permalink
fix: form组件validateTrigger设置的方法没有触发(#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing committed Jun 3, 2023
1 parent dec823a commit c29b039
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vantui/src/form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,15 @@ export function FormItem(props: FormItemProps) {
}
props[trigger] = handleChange
if (required || rules) {
const originValidateTrigger = props[validateTrigger]
? props[validateTrigger].bind({})
: undefined
// 这里不可以使用异步,否则会导致微信小程序输入框显示异常,详见:https://github.com/AntmJS/vantui/issues/459
props[validateTrigger] = (e: any) => {
if (validateTrigger === trigger) {
handleChange(e, true)
} else {
originValidateTrigger?.(e)
dispatch({ type: 'validateFieldValue' }, _name)
}
}
Expand Down

0 comments on commit c29b039

Please sign in to comment.