/ / like
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
}) cannot be reversed