wxml
<cover-view class=‘ico-l-1’ bindtap = ‘like’>
<cover-image wx:if="{{like==true}}" src=’…/…/imgs/like_t.png’ class=‘ico-l-1-i’></cover-image>
<cover-image wx:if="{{like==false}}" src=’…/…/imgs/like_v.png’ class=‘ico-l-1-i’></cover-image>
</cover-view>
wxss
.ico-l-1 {
width: 70rpx;
height: 70rpx;
/* border: 1rpx solid #aaa; */
position: absolute;
left: 87vw;
top: 50vh;
}
.ico-l-1-i {
width: 100%;
height: 100%;
}
js
data:{like: false}
like: function() {
var that = this
if(that.data.like==true){
that.setData({
like: false
})
}else{
that.setData({
like: true
})
}
},