1.声明式跳转(标签控制跳转)
navigator 标签
属性:
url:要跳转的路径(可以使用相对路径,也可以使用绝对路径)
open-type:跳转方式。默认值为 navigat ,不能跳转至tabBar页面。
当值为 switchTab 时,可跳转至tabBat页面。
当值为 navigateBack 时,点击可返回原页面。
注:小程序跳转时严格区分tabBar页面与非tabBar页面。
代码演示:<navigator open-type=" " url=" ">跳转</navigator>
2.编程式跳转(js控制跳转)
wx.reLaunch 方法:关闭所有页面,打开到应用内的某个页面。
参数:
url:要跳转的路径。
代码演示:wx.reLaunch({
url:" ",
})
wx.red