vue里面动态更换图片
<span @click="togle"><img :src=" this.i == 0 ? srcs : nosrc" alt=""></span>export default{data(){return{i:0,srcs:require('../ima
·
<span @click="togle">
<img :src=" this.i == 0 ? srcs : nosrc" alt="">
</span>
export default{
data(){
return{
i:0,
srcs:require('../images/icon-up@2x.png'),
nosrc:require('../images/icon-down@2x.png')
}
},
methods:{
togle(){
if(this.i==0){
this.i=1;
}else{
this.i=0;
}
}
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)