微信小程序template绑定事件,event值为undefined

template.wxml
<template name="tabbar">
<view class="tabbar_box" style="background-color:{{tabbar.backgroundColor}}; border-top-color:{{tabbar.borderStyle}}; {{tabbar.position == 'top' ? 'top:0' : 'bottom:0'}}">

<block wx:for="{{tabbar.list}}" wx:for-item="item" wx:key="index">
  <view bindtap="forter" data-id="{{item.id}}" class="tabbar_nav" style="width:{{1/tabbar.list.length*100}}%;">
    <image class="tabbar_icon" src="{{item.selected ? item.selectedIconPath : item.iconPath}}"></image>
    <text style="color:{{item.selected ? tabbar.selectedColor : tabbar.color}}">{{item.text}}</text>
  </view>
</block>

</view>
</template>

template上绑定了一个名为forter的事件

template.js
var temp = {
forter: function (event){

//这个event为undefined
console.log(event)

}
}
export default temp

阅读 2.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题