实践:

1)

保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。

 

 

wx.switchTab(Object object) | 微信开放文档 https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html

 

路由格式

// app.json
{
  "tabBar": {
    "list": [{
      "pagePath": "index",
      "text": "首页"
    },{
      "pagePath": "other",
      "text": "其他"
    }]
  }
}
wx.switchTab({
  url: '/index'
})

 

wx.navigateTo(Object object) | 微信开放文档 https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html

以 Promise 风格 调用:支持

需要页面权限:小程序不能在插件页面中调用该接口,插件也不能在小程序页面中调用该接口

小程序插件:支持,需要小程序基础库版本不低于 2.2.2

在小程序插件中使用时,只能在当前插件的页面中调用

微信 Windows 版:支持

微信 Mac 版:支持

保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 wx.navigateBack 可以返回到原页面。小程序中页面栈最多十层

 

 

 

 

 

 

 

 

// app.json
{
  "tabBar": {
    "list": [{
      "pagePath": "index",
      "text": "首页"
    },{
      "pagePath": "other",
      "text": "其他"
    }]
  }
}
wx.switchTab({
  url: '/index'
})

相关文章:

  • 2021-07-03
  • 2021-06-21
  • 2022-12-23
  • 2021-06-01
  • 2021-08-11
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2021-06-14
相关资源
相似解决方案