From 1a0aa89c651f02ee9db38902e6d8c9b5001c1aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Tue, 17 May 2022 16:54:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BsAddress.vue | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/components/BsAddress.vue b/components/BsAddress.vue index b74d846..82d8c27 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -212,13 +212,7 @@ export default { onCanceloperation() { let vm = this; vm.isOperation = false; - vm.$set(vm.selectData.area, "value", ""); - vm.$set(vm.selectData.city, "value", ""); - vm.$set(vm.selectData.province, "value", ""); - vm.$set(vm, "detailAddress", ""); - vm.$set(vm, "defaultAddress", ""); - vm.$set(vm, "addressUser", ""); - vm.$set(vm, "addressPhone", ""); + vm.clearForm(); vm.$emit("onSaveSuccess"); }, onEdit() { @@ -274,8 +268,8 @@ export default { }, async onAddAddress() { let vm = this; - let curItem = vm.addressList[vm.editIndex] - console.log(`vm.addressPhone != curItem.phone`,vm.addressPhone , curItem); + let curItem = vm.addressList[vm.editIndex]; + console.log(`vm.addressPhone != curItem.phone`, vm.addressPhone, curItem); if (!vm.selectData?.area?.code) { vm.$message.error("请选择所在区域~"); return; @@ -313,13 +307,7 @@ export default { } if (!res.error) { vm.$message.success("添加成功!"); - vm.$set(vm.selectData.area, "value", ""); - vm.$set(vm.selectData.city, "value", ""); - vm.$set(vm.selectData.province, "value", ""); - vm.$set(vm, "detailAddress", ""); - vm.$set(vm, "defaultAddress", ""); - vm.$set(vm, "addressUser", ""); - vm.$set(vm, "addressPhone", ""); + vm.clearForm(); vm.$emit("onSaveSuccess"); vm.isEdit = false; vm.getAddressData(); @@ -332,6 +320,19 @@ export default { vm.$emit("emitAddress", item); vm.dialogVisible = false; }, + clearForm() { + let vm = this; + vm.$set(vm.selectData.area, "value", ""); + vm.$set(vm.selectData.city, "value", ""); + vm.$set(vm.selectData.province, "value", ""); + vm.$set(vm.selectData.area, "code", ""); + vm.$set(vm.selectData.city, "code", ""); + vm.$set(vm.selectData.province, "code", ""); + vm.$set(vm, "detailAddress", ""); + vm.$set(vm, "defaultAddress", ""); + vm.$set(vm, "addressUser", ""); + vm.$set(vm, "addressPhone", ""); + }, }, };