表单进入验证没有问题

This commit is contained in:
gary.fu
2024-01-10 16:13:21 +08:00
parent 6ca4ac6168
commit 804d47df3b
2 changed files with 14 additions and 8 deletions

View File

@@ -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暴露============//

View File

@@ -177,7 +177,7 @@ export const useBaseTopMenus = () => {
{
icon: 'user',
isDropdown: true,
label: $i18nMsg(loginConfigStore.accountInfo.userNameCN, loginConfigStore.accountInfo.userNameEN),
label: loginConfigStore.accountInfo ? $i18nMsg(loginConfigStore.accountInfo.userNameCN, loginConfigStore.accountInfo.userNameEN) : '',
children: [
{
labelKey: 'common.label.personalInfo',