1. 程式人生 > >uni-app 點擊切換圖標

uni-app 點擊切換圖標

exp cti bsp change 周期 return shu this nbsp

前端代碼:

<template>
<view>
<image src="../../static/pari/buxihuan.png" v-show="showUpImg" @click="changeImg"></image>
<image src="../../static/pari/dianshubuz.png" v-show="!showUpImg" @click="changeImg"></image>
</view>
</template>

生命周期

export default {
data() {

return {
showUpImg:true
};
},
methods:{
changeImg:function(){
this.showUpImg = !this.showUpImg
}
},

}

uni-app 點擊切換圖標