感觉是刷新清楚了页面栈,这种情况大家如何做正常的返回前一个页面么?

9***@qq.com
- 发布:2019-03-26 14:00
- 更新:2020-04-30 15:33
- 阅读:6735
h5端。 页面刷新后无法使用uni.navigateBack({ delta: 1});
分类:uni-app

2***@qq.com - 前端开发小菜鸡
back() {
// #ifdef H5
let canBack = true
const pages = getCurrentPages()
// 有可返回的页面则直接返回,uni.navigateBack默认返回失败之后会自动刷新页面 ,无法继续返回
if (pages.length > 1) {
uni.navigateBack(1)
return;
}
// vue router 可以返回uni.navigateBack失败的页面 但是会重新加载
let a = this.$router.go(-1)
// router.go失败之后则重定向到首页
if (a == undefined) {
uni.reLaunch({
url: "/pages/tabbar/index"
})
}
return;
// #endif
uni.navigateBack(1)
},
今天回复我了吗
感谢
2020-06-16 00:30