Skip to content

Commit

Permalink
fix: 若干警告信息
Browse files Browse the repository at this point in the history
  • Loading branch information
yt0379 committed Sep 15, 2020
1 parent b488f89 commit d3e8952
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/form-item/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
setup(props) {
const isNested = ref(false)
const elForm = inject('elForm', {})
const elFormItem = inject('elFormItem')
const elFormItem = inject('elFormItem', null)
isNested.value = !!elFormItem
useDispatchFiled(props)
Expand Down
22 changes: 12 additions & 10 deletions packages/form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,19 @@ const useValidate = (rules, model, fields, validateOnRuleChange) => {
})
}
watch(rules, () => {
// remove then add event listeners on form-item after form rules change
fields.forEach((field) => {
field.removeValidateEvents()
field.addValidateEvents()
})
if (rules) {
watch(rules, () => {
// remove then add event listeners on form-item after form rules change
fields.forEach((field) => {
field.removeValidateEvents()
field.addValidateEvents()
})
if (unref(validateOnRuleChange)) {
validate(() => {})
}
})
if (unref(validateOnRuleChange)) {
validate(() => {})
}
})
}
return { validateField, validate, clearValidate }
}
Expand Down

0 comments on commit d3e8952

Please sign in to comment.