diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index 543c1445..947bb2fe 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -209,7 +209,7 @@ @@ -244,6 +244,10 @@ const dialog = reactive({ title: "", type: "" as DialogType, // 修改账号资料,修改密码、绑定手机、绑定邮箱 }); +const userProfileFormRef = ref(); +const passwordChangeFormRef = ref(); +const mobileBindingFormRef = ref(); +const emailBindingFormRef = ref(); const userProfileForm = reactive({}); const passwordChangeForm = reactive({}); @@ -410,6 +414,22 @@ const handleSubmit = async () => { } }; +/** + * 取消 + */ +const handleCancel = () => { + dialog.visible = false; + if (dialog.type === DialogType.ACCOUNT) { + userProfileFormRef.value?.resetFields(); + } else if (dialog.type === DialogType.PASSWORD) { + passwordChangeFormRef.value?.resetFields(); + } else if (dialog.type === DialogType.MOBILE) { + mobileBindingFormRef.value?.resetFields(); + } else if (dialog.type === DialogType.EMAIL) { + emailBindingFormRef.value?.resetFields(); + } +}; + const fileInput = ref(null); const triggerFileUpload = () => {