qq_古韵弥鹮_0
2018-06-23 11:09
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,你少些一个字母
入门微信小程序开发
172015 学习 · 323 问题
相似问题
回答 1
回答 2