|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import type { PropType, ExtractPropTypes, ComputedRef } from 'vue'; |
|
|
|
|
import { PropType, ExtractPropTypes, ComputedRef, watch } from 'vue'; |
|
|
|
|
import { defineComponent, computed, nextTick, ref, watchEffect, onBeforeUnmount } from 'vue'; |
|
|
|
|
import cloneDeep from 'lodash-es/cloneDeep'; |
|
|
|
|
import PropTypes from '../_util/vue-types'; |
|
|
|
@ -271,6 +271,13 @@ export default defineComponent({
|
|
|
|
|
clearValidate, |
|
|
|
|
resetField, |
|
|
|
|
}); |
|
|
|
|
let registered = false; |
|
|
|
|
watch( |
|
|
|
|
fieldName, |
|
|
|
|
val => { |
|
|
|
|
if (val) { |
|
|
|
|
if (!registered) { |
|
|
|
|
registered = true; |
|
|
|
|
formContext.addField(eventKey, { |
|
|
|
|
fieldValue, |
|
|
|
|
fieldId, |
|
|
|
@ -281,6 +288,14 @@ export default defineComponent({
|
|
|
|
|
validateRules, |
|
|
|
|
rules: rulesRef, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
registered = false; |
|
|
|
|
formContext.removeField(eventKey); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ immediate: true }, |
|
|
|
|
); |
|
|
|
|
onBeforeUnmount(() => { |
|
|
|
|
formContext.removeField(eventKey); |
|
|
|
|
}); |
|
|
|
|