ant-design / ant-design-pro

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

🐛 [BUG] 在ant design pro 的config/defaultSettings.ts中修改title值为false后,界面无法正常渲染。 #11294

Open Crescently opened 1 month ago

Crescently commented 1 month ago

🐛 bug 描述

在ant design pro 的config/defaultSettings.ts中修改title值为false后,界面无法正常渲染。 而config/config.ts 中的title属性没有正常读取

📷 复现步骤 | Recurrence steps

import {ProLayoutProps} from '@ant-design/pro-components';

/**

export default Settings;

🏞 期望结果 | Expected results

通过修改,改变页面标题

报错提示内容

Uncaught Invariant Violation: Helmet expects a string as a child of . Did you forget to wrap your children in braces? ( <title>{``} ) Refer to our API for more information.

github-actions[bot] commented 1 month ago

以下的 Issues 可能会帮助到你 / The following issues may help you

Crescently commented 1 month ago

Bug原因: 在pages/User/Login的Index.tsx中有如下一段代码

 <Helmet>
        <title>
          {'登录'} - {Settings.title}
        </title>
      </Helmet>

当设置title属性为false后会出现问题. 解决方法:

 <Helmet>
        <title>
          {'登录'}- {Settings.title || ""}
        </title>
      </Helmet>
Crescently commented 1 month ago

但是title属性仍然无法像官方文档介绍的一样起作用