ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🐛[BUG]使用SettingDrawer后,LayoutSettings都带进链接里了 #3248

Closed lufinka closed 3 years ago

lufinka commented 3 years ago

🐛 bug 描述

"umi-plugin-setting-drawer": "^1.0.3" 安装后所有页面链接会自动加上config/defaultSettings.ts中LayoutSettings的配置项:http://localhost:8000/antdpro/manage/user/info?navTheme=light&layout=top&fixSiderbar=true&title=%E6%99%BA%E8%83%BD%E5%AE%A1%E6%A0%B8&primaryColor=%231890ff&colorWeak=false&pwa=false&logo=https%3A%2F%2Fgw.alipayobjects.com%2Fzos%2Frmsportal%2FKDpgvguMpGfqaHPjicRK.svg

📷 复现步骤

🏞 期望结果

期望不粗线在url中,不影响路由传参

💻 复现代码

© 版本信息

🚑 其他信息

chenshuai2144 commented 3 years ago

SettingDrawer

SettingDrawer 提供了一个图形界面来设置 layout 的配置。不建议在正式环境中使用。

参数 | 说明 | 类型 | 默认值 -- | -- | -- | -- settings | layout 的设置 | Settings \| Settings | - onSettingChange | Settings 发生更改事件 | (settings: [Settings](#Settings) ) => void | - hideHintAlert | 删除下方的提示信息 | boolean | - disableUrlParams | 禁止同步设置到查询参数 | boolean | false
lufinka commented 3 years ago

@chenshuai2144 antd pro V5中安装插件就直接显示了SettingDrawer,大佬哪里设置disableUrlParams这个参数?

chenshuai2144 commented 3 years ago

在initialValues.setting 里设置一下

lufinka commented 3 years ago

在initialValues.setting 里设置一下

没有找到配置入口,请问在哪里设置?

chenshuai2144 commented 3 years ago

src/app.tsx

export async function getInitialState(): Promise<{
  settings?: Partial<LayoutSettings>;
  currentUser?: API.CurrentUser;
  fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> 
  return {
    fetchUserInfo,
    settings: { disableUrlParams },
  };
}
lufinka commented 3 years ago

src/app.tsx

export async function getInitialState(): Promise<{
  settings?: Partial<LayoutSettings>;
  currentUser?: API.CurrentUser;
  fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> 
  return {
    fetchUserInfo,
    settings: { disableUrlParams },
  };
}

settings与disableUrlParams是平级关系,不能在settings中设置呀?

chenshuai2144 commented 3 years ago

settings: { disableUrlParams }, 不是平级的