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() {