mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
fix: vben form bug
This commit is contained in:
parent
3e9768374b
commit
91b4280625
@ -19,10 +19,10 @@ const { createMessage } = useMessage()
|
|||||||
const emit = defineEmits(['success', 'register'])
|
const emit = defineEmits(['success', 'register'])
|
||||||
const isUpdate = ref(true)
|
const isUpdate = ref(true)
|
||||||
|
|
||||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = useForm({
|
||||||
labelWidth: 120,
|
labelWidth: 120,
|
||||||
baseColProps: { span: 24 },
|
baseColProps: { span: 24 },
|
||||||
schemas: isUpdate? updateFormSchema : createFormSchema,
|
schemas: createFormSchema,
|
||||||
showActionButtonGroup: false,
|
showActionButtonGroup: false,
|
||||||
actionColOptions: { span: 23 }
|
actionColOptions: { span: 23 }
|
||||||
})
|
})
|
||||||
@ -32,6 +32,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
|||||||
setModalProps({ confirmLoading: false })
|
setModalProps({ confirmLoading: false })
|
||||||
isUpdate.value = !!data?.isUpdate
|
isUpdate.value = !!data?.isUpdate
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
|
resetSchema(updateFormSchema)
|
||||||
const res = await get${simpleClassName}(data.record.id)
|
const res = await get${simpleClassName}(data.record.id)
|
||||||
setFieldsValue({ ...res })
|
setFieldsValue({ ...res })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user