mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-17 16:05:53 +08:00
[仅供测试]重写navigateTo方法,解决微信小程序中超过10个页面栈时会出现的bug
This commit is contained in:
24
utils/navigateRoute.js
Normal file
24
utils/navigateRoute.js
Normal file
@@ -0,0 +1,24 @@
|
||||
export function navigateTo({url}) {
|
||||
// #ifdef MP-WEIXIN
|
||||
//判断当前页面栈的长度
|
||||
if (getCurrentPages().length >= 8) {
|
||||
//超过八层的时候跳转销毁当前页面,十层的时候手机应该会很卡;
|
||||
uni.redirectTo({
|
||||
url: url,
|
||||
success: function (res) {},
|
||||
fail: function (res) {},
|
||||
complete: function (res) {},
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
Reference in New Issue
Block a user