//点赞
api.addLikeDiary(data).then((res)=>{
if (res.code == 0) { let index = event.currentTarget.dataset.index //下标 let isLike = this.data.diaryListInfo[`${index}`].isLike let likeCount = this.data.diaryListInfo[`${index}`].likeCount this.setData({ [isLike]:!isLike }) if (isLike) { this.setData({ [likeCount]: likeCount -= 1 }) } else { this.setData({ [likeCount]: likeCount += 1 }) } } })
this.setData({
[isLike]:!isLike
}) 无法取反
呼如林
相关分类