From bec22c3a983a5d9ed861c06818f80a0865db8568 Mon Sep 17 00:00:00 2001 From: Theo <971366405@qq.com> Date: Tue, 29 Apr 2025 10:12:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=BC=B9=E7=AA=97=E5=8F=96=E6=B6=88=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 个人中心弹出样取消重置表单 --- src/views/profile/index.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 = () => {