添加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

原文地址:https://www.cnblogs.com/tanweiwei/p/11971852.html