Ant-design-pro: How to change the settings for different layouts?[问题]

Created on 9 Oct 2019  ·  4Comments  ·  Source: ant-design/ant-design-pro

问题描述 [详细地描述问题,让大家都能理解]
I want to use a different theme for some of the pages of my site using the Ant Design Pro template. The defaultSettings.ts in config folder is applied to all the pages. How can I create and apply different settings to a new layout?
[翻译 Translation (来自Google ): 我想使用Ant Design Pro模板为网站的某些页面使用不同的主题。 config文件夹中的defaultSettings.ts将应用于所有页面。如何创建不同的设置并将其应用于新布局?]

Most helpful comment

Thank you for your response. Which url parameter? How do I change it? Can you please provide some references that I can use?

I am trying to change the pageTitle in the header, which is also why I had asked if we can change the settings. The title in the settings gets applied to all pages using the ProLayout with sidebar. How can I change the pageTitle in the menu header to be different for different pages?

Ant Design pro Menu header

For example, I want to change the title 'Ant Design Pro' to 'Admin' in one page and to 'Settings' in another. How can I do that?

you can in getSetting() of setting.ts, according to different url pathName setting title, For example
if (urlParams.pathname === 'xxxxx') { state.title = 'your title'; }

All 4 comments

Pro does not support this usage, but we support the url parameter to modify, you can use this method to dynamically modify

Thank you for your response. Which url parameter? How do I change it? Can you please provide some references that I can use?

I am trying to change the pageTitle in the header, which is also why I had asked if we can change the settings. The title in the settings gets applied to all pages using the ProLayout with sidebar. How can I change the pageTitle in the menu header to be different for different pages?

Ant Design pro Menu header

For example, I want to change the title 'Ant Design Pro' to 'Admin' in one page and to 'Settings' in another. How can I do that?

Thank you for your response. Which url parameter? How do I change it? Can you please provide some references that I can use?

I am trying to change the pageTitle in the header, which is also why I had asked if we can change the settings. The title in the settings gets applied to all pages using the ProLayout with sidebar. How can I change the pageTitle in the menu header to be different for different pages?

Ant Design pro Menu header

For example, I want to change the title 'Ant Design Pro' to 'Admin' in one page and to 'Settings' in another. How can I do that?

you can in getSetting() of setting.ts, according to different url pathName setting title, For example
if (urlParams.pathname === 'xxxxx') { state.title = 'your title'; }

Thanks for clarifying that. I also was able to modify a few of the settings using <ProLayout /> props for theme, title and navigation.

Thanks again @chenshuai2144 for the awesome work you have been doing with this project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renyi818 picture renyi818  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments

yaoleiroyal picture yaoleiroyal  ·  3Comments

gaoqiang19514 picture gaoqiang19514  ·  3Comments

RichardStark picture RichardStark  ·  3Comments