组件
<view class="">
<v-like bind:tap="onTest" like="{{classic.like_status}}" count="{{classic.fav_nums}}"></v-like>
</view>
js
onTest:function() {
let classic = this.data.classic
let count = classic.fav_nums;
let like = classic.like_status;
if (like) {
count -= 1
} else {
count += 1
}
classic.fav_nums = count
classic.like_status = !like
this.setData({
classic:classic
})
}
老师,我这样在组件上绑定事件可以吗,好像也能完成功能