ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.28k stars 8.14k forks source link

🐛 [BUG] ant design pro v6 登录页面无页面标题 #10403

Closed hihuangwei closed 1 year ago

hihuangwei commented 1 year ago

🐛 bug 描述

ant design pro v6 登录页面无页面标题

image

xXAvoraXx commented 1 year ago

V5

Hexi1997 commented 1 year ago

可以在 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';
      }
    }
  }
}
Hexi1997 commented 1 year ago

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) || '';
}
liangzhaoliang95 commented 1 year ago

请问一下这个是怎么起的,官方例子中没有5.0版本antdesign啊