mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2025-12-09 20:37:48 +00:00
表单进入验证没有问题
This commit is contained in:
@@ -95,14 +95,20 @@ const emit = defineEmits(['submitForm', 'update:model'])
|
||||
|
||||
const formModel = useVModel(props, 'model', emit)
|
||||
|
||||
watch(() => props.options, (options) => {
|
||||
options.forEach(option => {
|
||||
if (formModel.value) {
|
||||
formModel.value[option.prop] = option.value || undefined
|
||||
}
|
||||
})
|
||||
const initFormModel = () => {
|
||||
if (formModel.value) {
|
||||
props.options.forEach(option => {
|
||||
if (option.prop) {
|
||||
formModel.value[option.prop] = option.value || undefined
|
||||
}
|
||||
})
|
||||
}
|
||||
rules.value = initRules()
|
||||
}, { deep: true })
|
||||
}
|
||||
|
||||
initFormModel()
|
||||
|
||||
watch(() => props.options, initFormModel, { deep: true })
|
||||
|
||||
//= ============form暴露============//
|
||||
|
||||
|
||||
Reference in New Issue
Block a user