贊踩不帶資料的展示
阿新 • • 發佈:2018-11-11
xml:
<view class='box1'> <view class='box' bindtap="onChangeShowState"> <image src="{{isPlaying?'/img/cai1.png':'/img/cai2.png'}}" class='had had1'></image> <text class='had_text'>不好看</text> </view> <view class='box' bindtap="onChangeShowState2"> <image src="{{isPlaying1?'/img/zan1.png':'/img/zan2.png'}}" class='had'></image> <text class='had_text'>好看</text> </view> </view> css: //自定義 js: //踩 onChangeShowState: function() { var that = this; that.setData({ isPlaying: (!that.data.isPlaying), isPlaying1: (!that.data.releaseFocus)}) }, //贊 onChangeShowState2: function() { var that = this; that.setData({ isPlaying1: (!that.data.isPlaying1), isPlaying: (!that.data.releaseFocus) }) },