小程序的基本原生js使用

时间:2018-10-26 12:32:09   收藏:0   阅读:446

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.

 <view class="fishqcTrycurrentProduct" wx:for="{{tryarray}}" wx:if="{{havacurrentdata}}" wx:key="{{item.id}}">

怎么样去修改变量名?

<view wx:for="{{array}}" wx:for-index="idx" wx:for-item="itemName">
  {{idx}}: {{itemName.message}}
</view>

原文:https://www.cnblogs.com/antyhouse/p/9855530.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!