微信小程序底部菜单路径(tabBar)在页面内部跳转相同不能跳转

app.json
{
“tabBar”: {
“list”: [{
“pagePath”: “index/index”,
“text”: “首页”
},{
“pagePath”: “index/other”,
“text”: “其他”
}]
}
}

方法一
other.wxml
<view bindtap=”ceshi”>切换到首页 </view>
other.js
ceshi: function (){
wx.switchTab({
url: ‘/index/index’
})
},
方法二
other.wxml
注意只有tabBar的链接才能使用 open-type=”switchTab”,正常页面可以使用redirect,navigate,reLaunch
<navigator url=”/index/index” open-type=”switchTab”>切换到首页</navigator>

posted @ 2020-03-27 18:33  少爷专用  阅读(1012)  评论(0)    收藏  举报