From b23b80c2f052ab567d26e8d045d749706a92d4a8 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 19 Apr 2021 20:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=BE=91=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E6=97=B6form=E7=9A=84=E6=A0=A1=E9=AA=8C=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/shop/edit.vue | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/views/shop/edit.vue b/src/views/shop/edit.vue index 345b672..37796ba 100644 --- a/src/views/shop/edit.vue +++ b/src/views/shop/edit.vue @@ -93,7 +93,7 @@ export default class extends Vue { private postForm = Object.assign({}, defaultShopData) private loading = false private rules = { - title: [{ validator: this.validateRequire }], + name: [{ validator: this.validateRequire }], } private tempTagView?: ITagView @@ -146,23 +146,23 @@ export default class extends Vue { document.title = `${title} - ${this.postForm._id}` } - private submitForm() { - (this.$refs.postForm as Form).validate(async valid => { - if (valid) { - this.loading = true - await saveShop(this.postForm) - this.loading = false - this.$notify({ - title: 'Success', - message: 'The post published successfully', - type: 'success', - duration: 2000 - }) - } else { - console.error('Submit Error!') - return false - } - }) + private async submitForm() { + const form =
this.$refs.postForm + try { + await form.validate() + this.loading = true + await saveShop(this.postForm) + this.loading = false + this.$notify({ + title: 'Success', + message: 'The post published successfully', + type: 'success', + duration: 2000 + }) + } catch (err) { + console.error('Submit Error!') + return false + } } private draftForm() {