切换字体的颜色

<!-- index.wxml -->

<view class="container">
 <text class="{{color}}" catchtap="click">点击文字</text>
</view>


<!-- index.wxss -->

.window-red{
  color: gold;
}


<!-- index.js -->
var flag = true;
var color = 'window';
Page({
  click:function(){
    if(flag){
      color = "window-red";
      flag = false;
    }else{
      color = "window"
      flag = true;
    }
    this.setData({
      color
    })
  },
}

 

posted @ 2019-08-05 12:01  好胖的兔子  阅读(226)  评论(0编辑  收藏  举报