问答详情
源自:2-2 首页开发(下)

出现这个的原因 TypeError: Cannot read property 'dataset' of undefined ,目前没有解决

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>


提问者:qq_古韵弥鹮_0 2018-06-23 11:09

个回答

  • boniu
    2018-06-24 14:32:20

    https://img.mukewang.com/5b2f3ab20001de1f06270608.jpg

    这个地方应该是currentTarget,你少些一个字母