1.点击事件
<a data-current="{ {setting.current}}" bindtap="clickcurrent" style="color:{ {currentSelect.key == 'current'?mainColor:oldcolor}};"> <text>本期试用</text> <text class="activeline" style="background-color:{ {currentSelect.key == 'current'?mainColor:whiteColor}};"></text> </a> bindtap="clickcurrent"
2.style的使用
style="color:{ {currentSelect.key == 'current'?mainColor:oldcolor}};"
3.传值
data-current="{ {setting.current}}"
如何获取
传过来event ,然后写event.currentTarget.dataset.current
4.wx:if的动态使用
wx:if="{ {currentSelect.key == 'current'}}"
5.循环的使用,默认item和index.
怎么样去修改变量名?
{ {idx}}: { {itemName.message}}
6.设置数据
var that = this that.setData({ currentSelect: event.currentTarget.dataset.current })