fix(router): 修复路由不存在判断逻辑错误
原逻辑使用every判断会导致条件始终为true,现改为some确保正确检测不存在的路由
This commit is contained in:
@@ -45,7 +45,7 @@ export const navigateToInterceptor = {
|
||||
}
|
||||
|
||||
// 处理路由不存在的情况
|
||||
if (getAllPages().every(page => page.path !== path) && path !== '/') {
|
||||
if (path !== '/' && !getAllPages().some(page => page.path !== path)) {
|
||||
console.warn('路由不存在:', path)
|
||||
uni.navigateTo({ url: NOT_FOUND_PAGE })
|
||||
return false // 明确表示阻止原路由继续执行
|
||||
|
||||
Reference in New Issue
Block a user