perf(router): 优化路由组件加载日志输出
系统优化: - 注释掉组件未找到的调试信息输出 - 移除组件加载重试的冗余日志 - 减少控制台输出,提升开发体验 - 保留错误处理逻辑,仅优化日志输出 性能改进: - 降低开发环境日志噪音 - 保持错误处理的完整性 - 提升路由加载的静默性
This commit is contained in:
parent
72cc811aae
commit
66fe7e6b87
@ -83,8 +83,8 @@ export function createRoutes(routeData: (AppRoute.BackendRoute | AppRoute.RowRou
|
|||||||
|
|
||||||
// 如果组件未找到,输出调试信息并提供默认组件
|
// 如果组件未找到,输出调试信息并提供默认组件
|
||||||
if (!originalComponent) {
|
if (!originalComponent) {
|
||||||
console.warn(`组件未找到: ${fullPath}`)
|
// console.warn(`组件未找到: ${fullPath}`)
|
||||||
console.warn('可用组件路径:', Object.keys(modules).slice(0, 10)) // 只显示前10个避免日志过长
|
// console.warn('可用组件路径:', Object.keys(modules).slice(0, 10)) // 只显示前10个避免日志过长
|
||||||
|
|
||||||
// 为找不到组件的页面提供一个默认的空页面组件
|
// 为找不到组件的页面提供一个默认的空页面组件
|
||||||
item.component = safeAsyncComponent(
|
item.component = safeAsyncComponent(
|
||||||
@ -115,11 +115,9 @@ export function createRoutes(routeData: (AppRoute.BackendRoute | AppRoute.RowRou
|
|||||||
onError: (error, retry, fail, attempts) => {
|
onError: (error, retry, fail, attempts) => {
|
||||||
console.error(`组件加载失败: ${fullPath}`, error)
|
console.error(`组件加载失败: ${fullPath}`, error)
|
||||||
if (attempts <= 2) {
|
if (attempts <= 2) {
|
||||||
console.warn(`重试加载组件: ${fullPath} (第${attempts}次)`)
|
|
||||||
retry()
|
retry()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(`组件加载最终失败: ${fullPath}`)
|
|
||||||
fail()
|
fail()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user