The effect is as follows:
No collections:
collected:
Code:
1 <view class="jichu"> 2 <view class="name">xxx</view> 3 <image class="collection" src="../../../static/image/ic_weishoucang.png" v-show="showUpImg" @click="changeImg"></image> 4 <image class="collection" src="../../../static/image/[email protected]" v-show="!showUpImg" @click="changeImg"></image> 5 </view>
1 data () { 2 return { 3 showUpImg: true 4 } 5 }
1 methods:{ 2 changeImg:function(){ 3 this.showUpImg = !this.showUpImg 4 }, 5 }
To