猿问

小程序自定义组件中slot 中data-id 无法在外层 bind tap 获取到?

<view class="container" 
  style="flex-direction:{{vertical?'column':'row'}}" bindtap='onCheckedChanged'>
  <slot></slot>
</view>

<xradiogroup vertical="{{false}}">
  <view class="radio checked" data-id="{{0}}">A</view>
  <view class="radio uncheck" data-id="{{1}}">B</view>
  <view class="radio uncheck" data-id="{{2}}">C</view>
</xradiogroup>

methods: {
    onCheckedChanged:function(e){
      console.log(e);
      var select = e.target.dataset.id;
      console.log('selected ->' + select);
    }
  }


青不青
浏览 2704回答 1
1回答
随时随地看视频慕课网APP
我要回答