From 5e5b5f4dc20026193d44a3ff55588417ac125187 Mon Sep 17 00:00:00 2001 From: daihh Date: Fri, 3 Jun 2022 11:41:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=B0Dev=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/interact-fixed/interact-fixed.vue | 34 +++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/components/interact-fixed/interact-fixed.vue b/components/interact-fixed/interact-fixed.vue index b03a64f..1b9ad02 100644 --- a/components/interact-fixed/interact-fixed.vue +++ b/components/interact-fixed/interact-fixed.vue @@ -289,21 +289,25 @@ export default { }) }, checkHas(){ - if(this.type>0){ - apiPraises.has(this.type,this.data.id).then(rs=>{ - if(rs.status==200 && rs.result){ - this.isPraise=true; - }else{ - this.isPraise=false; - } - }); - apiFavorites.has(this.type,this.data.id).then(rs=>{ - if(rs.status==200 && rs.result){ - this.isFavorite=true; - }else{ - this.isFavorite=false; - } - }) + if(this.type>0 && this.data.id){ + if(this.praises){ + apiPraises.has(this.type,this.data.id).then(rs=>{ + if(rs.status==200 && rs.result){ + this.isPraise=true; + }else{ + this.isPraise=false; + } + }); + } + if(this.favorites){ + apiFavorites.has(this.type,this.data.id).then(rs=>{ + if(rs.status==200 && rs.result){ + this.isFavorite=true; + }else{ + this.isFavorite=false; + } + }) + } } }, submit(){