作者:手机用户2602898385 | 来源:互联网 | 2023-07-15 01:51
返回上一层的navigateBack路由要是与配置的tabBar栏目路由相同的话,返回会失效
,需换用switchTab
//app.json里面设置的tabBar
"tabBar": {
"list": [
{
"text": "返利",
"pagePath": "pages/index/main",
"iconPath": "static/images/menu_home.png",
"selectedIconPath": "static/images/menu_home_active.png"
},
{
"text": "平台",
"pagePath": "pages/hello/main",
"iconPath": "static/images/menu_platform.png",
"selectedIconPath": "static/images/menu_platform_active.png"
}
]
},
后退
methods: {
navigateBack(){
wx.navigateBack({
delta: 1,
success: () => {
console.log('success')
},
fail: () => {
console.log('fail')
}
})
},
}
另外,mpvue里面,用标签属性做路由跳转的话,open-type
属性值要注意:
1.open-type="switchTab" 跳转tabBar路由
2.open-type="navigate" 跳转非tabBar路由(默认值)
去往首页-way1
去往counter
返回非tabBar
跳转tabBar