From 28ad8f3313327111f348cefd808e9b61e150af4c Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Thu, 29 Oct 2020 12:49:30 +0100 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E7=9A=84=E8=AF=9D=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E5=B7=B2=E5=AD=98=E5=9C=A8=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Detail.vue | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/Detail.vue b/src/components/Detail.vue index 558dea6..e115ff8 100644 --- a/src/components/Detail.vue +++ b/src/components/Detail.vue @@ -173,18 +173,19 @@ export default { }, async starEvent () { const db = await star.find({ key: this.detail.key, ids: this.info.id }) + const doc = { + key: this.detail.key, + ids: this.info.id, + site: this.detail.site, + name: this.info.name, + detail: this.info, + rate: this.info.rate + } if (db) { - this.$message.info('该影片已被收藏') + star.update(db.id, doc) + this.$message.success('收藏更新成功') } else { - const docs = { - key: this.detail.key, - ids: this.info.id, - site: this.detail.site, - name: this.info.name, - detail: this.info, - rate: this.info.rate - } - star.add(docs).then(res => { + star.add(doc).then(res => { this.$message.success('收藏成功') }) }