添加tabBar后, 页面原有的点击事件失效

首页点击链接到内页,刚开始是正常的,后后添加了tabBar以后,发现原先页面的链接点击没反应了。

更改之前的代码:

  onClickApply() {
    wx.navigateTo({
      url: '/pages/information/information'
    })
  }

将 wx.navigateTo 更改为 wx.switchTab 即可解决这个问题

 onClickApply() {
    wx.switchTab({
      url: '/pages/information/information'
    })
  }

官网资料介绍

https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html

https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html

posted @ 2019-12-02 17:09  维维WW  阅读(427)  评论(0编辑  收藏  举报