From e467fcc2cf1fc9498ae818f3c90f0a12410870ad Mon Sep 17 00:00:00 2001 From: francis-fh Date: Thu, 4 Jun 2026 23:21:52 +0800 Subject: [PATCH] 1111 --- config/defaultSettings.ts | 12 +++++++++--- src/app.tsx | 4 +++- src/global.less | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/config/defaultSettings.ts b/config/defaultSettings.ts index 581ed28..be9ea33 100644 --- a/config/defaultSettings.ts +++ b/config/defaultSettings.ts @@ -10,7 +10,8 @@ const Settings: ProLayoutProps & { navTheme: 'light', // 拂晓蓝 colorPrimary: '#1890ff', - layout: 'mix', + // 嵌入第三方平台:侧栏布局,无顶栏 + layout: 'side', contentWidth: 'Fluid', fixedHeader: false, fixSiderbar: true, @@ -20,8 +21,13 @@ const Settings: ProLayoutProps & { logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', iconfontUrl: '', token: { - // 参见ts声明,demo 见文档,通过token 修改样式 - //https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F + sider: { + colorMenuBackground: '#fff', + colorBgMenuItemSelected: '#e6f4ff', + colorTextMenu: 'rgba(0, 0, 0, 0.88)', + colorTextMenuSelected: '#1890ff', + colorTextMenuItemHover: 'rgba(0, 0, 0, 0.88)', + }, }, }; diff --git a/src/app.tsx b/src/app.tsx index f8da1a3..aecbe1d 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -102,6 +102,9 @@ export async function getInitialState(): Promise<{ // ProLayout 支持的api https://procomponents.ant.design/components/layout export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { return { + // 嵌入第三方平台:隐藏 ProLayout 顶栏(系统名、用户头像等) + headerRender: false, + menuHeaderRender: false, // actionsRender: () => [, ], actionsRender: () => [], avatarProps: { @@ -174,7 +177,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) = // , // ] // : [], - menuHeaderRender: undefined, // 自定义 403 页面 // unAccessible:
unAccessible
, // 增加一个 loading 的状态 diff --git a/src/global.less b/src/global.less index 81f10be..94d23ff 100644 --- a/src/global.less +++ b/src/global.less @@ -21,6 +21,28 @@ body, left: unset; } +// 管理端嵌入第三方:隐藏顶栏、侧栏白底 +.ant-pro-layout { + .ant-pro-global-header { + display: none !important; + } + + .ant-pro-sider.ant-layout-sider { + background: #fff !important; + + .ant-layout-sider-children, + .ant-pro-sider-menu, + .ant-menu.ant-menu-root { + background: #fff !important; + } + } + + // 无顶栏时内容区顶对齐 + .ant-pro-layout-content { + padding-block-start: 16px; + } +} + .ant-table-row { &-level-1 .ant-table-cell:first-child { padding-left: 24px !important;