mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 12:29:19 +08:00
wip:动态路由相关
This commit is contained in:
@@ -86,11 +86,28 @@ export function useTabbar() {
|
||||
};
|
||||
|
||||
function wrapperTabLocale(tab: RouteLocationNormalizedGeneric) {
|
||||
const title = tab?.meta?.title;
|
||||
let processedTitle = 'Unknown';
|
||||
|
||||
try {
|
||||
if (title && typeof title === 'string' && title.trim()) {
|
||||
// 尝试国际化处理
|
||||
processedTitle = $t(title);
|
||||
} else if (tab?.name) {
|
||||
// 如果没有 title,使用路由名称
|
||||
processedTitle = tab.name as string;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('国际化处理失败,使用原始标题:', title, error);
|
||||
// 如果国际化失败,直接使用原始标题
|
||||
processedTitle = title || (tab?.name as string) || 'Unknown';
|
||||
}
|
||||
|
||||
return {
|
||||
...tab,
|
||||
meta: {
|
||||
...tab?.meta,
|
||||
title: $t(tab?.meta?.title as string),
|
||||
title: processedTitle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user