第一步,把要改变样式添加到相应js文件的全局变量中,如: data : { color : '#000' }
第二步,将变量绑定到view中,如:
第三步,在view中添加事件,如: bindtap="changeColor"
第四步,在相应js文件中添加该自定义方法:
, changeColor: function(e){
this.setData({ color : '#fff' });
}
changColor:function(e){
this.setData({
key: e.target.dataset.index
})
},
userSelect:function(re){
console.log(re.currentTarget.id);
this.setData({
clickID:re.currentTarget.id
})
},