1、跳转到tabBar页面以及回退(回退没有实现)
<!-- 声明式跳转 wxml-->
<navigator url="/pages/message/message" open-type="switchTab">消息</navigator>
<!-- 必须要加switchTab -->
<!-- 编程式跳转页面 wxml-->
<button bindtap="goMess">消息</button>
//js
goMess(){
wx.switchTab({
url: '/pages/message/message',
})
},
2、跳转到非tabBar页面以及回退
<!-- 声明式跳转 wxml -->
<navigator url="/pages/info/info" >info页面</navigator>
<!-- open-type的值默认是navigate -->
<!-- 编程式跳转 wxml -->
<button bindtap="goinfo">info页面</button>
//js
goinfo(){
wx.navigateTo({
url: '/pages/info/info',
})
},
<!-- 后退导航 wxml-->
<!-- navigator -->
<navigator open-type = "navigateBack" delta="1">1返回</navigator>
<!-- 编程式后退导航 wxml-->
<button bindtap="back">2返回</button>
//js
back(){
wx.navigateBack()
},