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