微信小程序wxml的数据传给js 点击事件 js获取view中的内容

例子

wxml:

     <view class="itemmainwhite"  bindtap="onclick" wx:if="{{item.temp==0}}" data-text="{{item.index}}">{{item.index}}
        </view>

  

js:

  onclick: function (e) {
    console.log(e.currentTarget.dataset.text);
}

  

posted @ 2019-10-19 17:07  在学习编程的lsy呀  阅读(3042)  评论(0编辑  收藏  举报