Closed hihuangwei closed 1 year ago
V5
可以在 app.tsx 监听路由来临时处理
// 解决login页面不显示title的bug
export function onRouteChange({
clientRoutes,
location
}: {
clientRoutes: RouteObject[];
location: Location;
}) {
const route = matchRoutes(clientRoutes, location.pathname)?.pop()?.route;
if (route) {
if (route.path === '/login') {
const title = getI18NTextLocal(`menu.login`);
if (title) {
document.title = `${title} - AntdPro Admin Template`;
} else {
document.title = 'AntdPor Admin Template';
}
}
}
}
import enUS from '@/locales/en-US';
import zhCN from '@/locales/zh-CN';
// react-intl必须要在hooks中才能国际化,这里提供一个方法从非hooks中进行国际化
export function getI18NTextLocal(key: string) {
const locale = store.get('umi_locale');
if (locale === 'zh-CN') {
return (zhCN as Object)[key] as string;
}
return ((enUS as Object)[key] as string) || '';
}
请问一下这个是怎么起的,官方例子中没有5.0版本antdesign啊
🐛 bug 描述
ant design pro v6 登录页面无页面标题