微信小程序防止事件冒泡(catchtab的使用)

使用 catchtab ,在里层可以避免出现事件冒泡

 

 

 

 

 

  toDetail() {
    console.log('1')
  },

  toDetail2() {
    console.log('2')
  },

  toDetail3() {
    console.log('3')
  },

 情况1、外层 bindtab 里层也是 bindtab,结果如下

 

情况2、外层bindtab 里层 catchtab,,结果如下

 

posted @ 2022-10-20 21:32  w1433189426  阅读(405)  评论(0编辑  收藏  举报