uni-simple-router
uni-simple-router copied to clipboard
uniapp 在APP端跳转容易卡在当前页面正在处于跳转状态,要等很久才能跳转过去
问题描述 uniapp 在APP端跳转容易卡在当前页面正在处于跳转状态,要等很久才能跳转过去
复现步骤 09:37:07.740 [Object] {"type":2,"msg":"当前页面正在处于跳转状态,请稍后再进行跳转....","NAVTYPE":"push","uniActualData":{}} at router/index.js:8
router.js 关键代码
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
routerErrorEach:({type,level,...args})=>{
console.log({type,level,...args})
// #ifdef APP-PLUS
if(type===3){
router.$lockStatus=false;
uni.showModal({
title: '提示',
content: '您确定要退出应用吗?',
success: function (res) {
if (res.confirm) {
plus.runtime.quit();
}
}
});
}
// #endif
},
routes: [...ROUTES],
applet: {
animationDuration: 100 //默认 300ms v2.0.6+
},
detectBeforeLock: (router, to, navType) => { // 配置解锁[重要]。关闭跳转路由锁
router.$lockStatus=false;
},
APP: {
loddingPageStyle: () => JSON.parse('{"backgroundColor":"#9846FF"}'),
loddingPageHook: (view) => { view.show(); },
launchedHook: () => { plus.navigator.closeSplashscreen(); },
animation: { animationType: 'pop-in', animationDuration: 100 }
},
});
预期结果 不用等待或者卡死页面
实际结果 09:37:07.740 [Object] {"type":2,"msg":"当前页面正在处于跳转状态,请稍后再进行跳转....","NAVTYPE":"push","uniActualData":{}} at
补充信息 [可选] [根据你的分析,出现这个问题的原因可能在哪里?]
你这个配置方法应该不会出现被锁住的情况,因为你每次都把跳转锁解除掉了。你现在跳转一个页面需要等待多久时间?在app还是在小程序上
app上,如果数据没加载完成或点击频繁会出现这种情况,有时候等待十几秒有时候直接卡死
可以上传一个demo吗?锁死情况下routerErrorEach
有没有抛出什么错误
@SilurianYang 大佬 这个就是因为路由的page404造成的,你那边的配置没问题的,我研究过了