微信小程序 之 所有事件及传参

<view
wx:for="{{newArray.ye}}"
wx:key="{{index}}"
class='wxlist'
bindtap='GoDetails'
bindlongtap='longtap'
bindtouchend='touchend'
data-index='{{item.id}}'
data-indexd='{{index}}'
data-type="ye"
></view>
//涉及 点击 长按 及解决冲突 
//点击
GoDetails: function (event) {//检查锁if (this.data.lock){} else {}}
//手指离开
touchend: function () {if (this.data.lock) {//开锁setTimeout(() => {this.setData({ lock: false });}, 100);}}
//长按
longtap: function (event) {//锁住this.setData({ lock: true });}
//获取所有的传的参数
let index = event.currentTarget.dataset['index']
let indexd = event.currentTarget.dataset['indexd']
let types = event.currentTarget.dataset['type']

猜你喜欢

转载自blog.csdn.net/qinlulucsdn/article/details/80279943