组件 solt 中的事件问题
下面的示例代码:
<view class="tabs" slot="extra"> <view class="tab-item {{curTab===index?'active':''}}" wx:for="{{list}}" wx:key="{{index}}" bindtap="switchTab(index)">{{item.name}}</view> </view></card-section> |
会提示:Component “pages/home/index” does not have a method “switchTab(index)” to handle event “tap”.
实际上 switchTap 事件处理不在组件里面,而在使用组件的页面里面,从逻辑上来说也应该是在使用组件的页面里面,因为这部分逻辑是使用 slot 插入进入的,请帮忙解答一下
