From 3dc970e1988c217b5c88c1df0d0c4bf3e1913f89 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Tue, 25 Aug 2020 15:54:07 +0200 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B7=B2=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail.vue | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/Detail.vue b/src/components/Detail.vue index f9d5b96..8f9381f 100644 --- a/src/components/Detail.vue +++ b/src/components/Detail.vue @@ -132,19 +132,21 @@ export default { }, starEvent () { star.find({ key: this.detail.key, ids: this.info.id }).then(res => { + const docs = { + key: this.detail.site.key, + site: this.detail.site, + ids: this.info.id, + name: this.info.name, + type: this.info.type, + year: this.info.year, + last: this.info.last, + note: this.info.note + } if (res) { - this.$message.info('已存在') + star.update(res.id, docs).then(res => { + this.$message.success('已存在,更新成功') + }) } else { - const docs = { - key: this.detail.site.key, - site: this.detail.site, - ids: this.info.id, - name: this.info.name, - type: this.info.type, - year: this.info.year, - last: this.info.last, - note: this.info.note - } star.add(docs).then(res => { this.$message.success('收藏成功') })