From 7e3c8a967829beb6cdf937c724957bf08d3cfde2 Mon Sep 17 00:00:00 2001 From: From-wh Date: Fri, 30 Jun 2023 14:10:43 +0800 Subject: [PATCH] =?UTF-8?q?improve:=20=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?initData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/src/components/uploadImg/index.vue | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/template/admin/src/components/uploadImg/index.vue b/template/admin/src/components/uploadImg/index.vue index d9ca527d6..663e941ea 100644 --- a/template/admin/src/components/uploadImg/index.vue +++ b/template/admin/src/components/uploadImg/index.vue @@ -123,7 +123,7 @@ - 取 消 + 取 消 确 定 @@ -193,17 +193,6 @@ export default { this.time = undefined; }, methods: { - closed() { - console.log('1'); - this.ruleForm.type = 0; - this.ruleForm.region = 0; - this.scanToken = ''; - this.webImgUrl = ''; - this.ruleForm.imgList = []; - clearInterval(this.time); - this.time = undefined; - scanUploadCode().then((res) => {}); - }, radioChange(type) { this.ruleForm.type = type; this.ruleForm.imgList = []; @@ -255,6 +244,7 @@ export default { this.$emit('uploadSuccess'); this.uploadModal = false; this.loading = false; + this.initData(); } } } @@ -271,6 +261,7 @@ export default { this.$emit('uploadSuccess'); this.uploadModal = false; this.loading = false; + this.initData(); }) .catch((err) => { this.loading = false; @@ -285,6 +276,7 @@ export default { this.$Message.success('上传成功'); this.$emit('uploadSuccess'); this.uploadModal = false; + this.initData(); }); } }, @@ -397,6 +389,23 @@ export default { newItems.splice(dst, 0, ...newItems.splice(src, 1)); this.ruleForm.imgList = newItems; }, + closed() { + this.initData(); + scanUploadCode().then((res) => {}); + }, + clear() { + this.uploadModal = false; + this.initData(); + }, + initData() { + this.ruleForm.type = 0; + this.ruleForm.region = 0; + this.scanToken = ''; + this.webImgUrl = ''; + this.ruleForm.imgList = []; + clearInterval(this.time); + this.time = undefined; + }, }, };