Cannot read property 'dataset' of undefined;at pages/index/index page toDetail function
TypeError: Cannot read property 'dataset' of undefined
代码如下
toDetail: function (e) {
console.log(e);
var index = 1
index = e.currenTarget.dataset.index;
console.log(index);
}
<view class='item-list'>
<view class='pro-item'wx:for="{{proList}}" bindtap='toDetail' data-index='{{index}}'>
<image class='pro_logo'
src='{{item.logo}}'>
</image>
<view class='pro-body'>
<view class='pro-title'>{{item.title}}</view>
<text class='pro-desc'>{{item.desc}}</text>
<view class='pro-footer'>
<image class='btn_detail'
src='/images/btn_detail.png'>
</image>
<image class='btn_ask'
src='/images/btn_ask.png'>
</image>
</view>
</view>
</view>
</view>
这个地方应该是currentTarget,你少些一个字母