提交 ec5a5c49 编写于 作者: 陈帅

beter code

上级 d61911af
...@@ -23,7 +23,7 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & { ...@@ -23,7 +23,7 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
}; };
const BasicLayout: React.FC<BasicLayoutProps> = props => { const BasicLayout: React.FC<BasicLayoutProps> = props => {
const { dispatch, children, route } = props; const { dispatch, children, route, settings } = props;
const { routes, authority } = route!; const { routes, authority } = route!;
/** /**
* constructor * constructor
...@@ -38,7 +38,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => { ...@@ -38,7 +38,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
*/ */
const handleMenuCollapse = (payload: boolean) => const handleMenuCollapse = (payload: boolean) =>
dispatch!({ type: 'global/changeLayoutCollapsed', payload }); dispatch!({ type: 'global/changeLayoutCollapsed', payload });
return ( return (
<> <>
<BasicLayoutComponents <BasicLayoutComponents
...@@ -46,15 +45,16 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => { ...@@ -46,15 +45,16 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
onCollapse={handleMenuCollapse} onCollapse={handleMenuCollapse}
rightContentRender={RightProps => <RightContent {...RightProps} />} rightContentRender={RightProps => <RightContent {...RightProps} />}
{...props} {...props}
{...settings}
> >
{children} {children}
</BasicLayoutComponents> </BasicLayoutComponents>
<SettingDrawer <SettingDrawer
settings={props.settings} settings={settings}
onSettingChange={settings => onSettingChange={config =>
dispatch!({ dispatch!({
type: 'settings/changeSetting', type: 'settings/changeSetting',
payload: settings, payload: config,
}) })
} }
/> />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册