Commit fc136b6a authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

bugfix: fix #4349,UserLayout getPageTitle doesn't show title

parent 820b6391
import SelectLang from '@/components/SelectLang';
import GlobalFooter from '@/components/GlobalFooter';
import { ConnectProps } from '@/models/connect';
import { ConnectProps, ConnectState } from '@/models/connect';
import { connect } from 'dva';
import { Icon } from 'antd';
import React, { Component, Fragment } from 'react';
import React from 'react';
import DocumentTitle from 'react-document-title';
import { formatMessage } from 'umi-plugin-locale';
import { formatMessage } from 'umi-plugin-react/locale';
import Link from 'umi/link';
import logo from '../assets/logo.svg';
import styles from './UserLayout.less';
......@@ -29,32 +30,37 @@ const links = [
];
const copyright = (
<Fragment>
<>
Copyright <Icon type="copyright" /> 2019 θš‚θšι‡‘ζœδ½“ιͺŒζŠ€ζœ―部出品
</Fragment>
</>
);
export interface UserLayoutProps extends ConnectProps {
breadcrumbNameMap: { [path: string]: MenuDataItem };
navTheme: string;
}
class UserLayout extends Component<UserLayoutProps> {
render() {
const UserLayout: React.SFC<UserLayoutProps> = props => {
const {
route = {
routes: [],
},
} = this.props;
} = props;
const { routes = [] } = route;
const { children, location } = this.props;
const { breadcrumb } = getMenuData(routes, this.props);
const {
children,
location = {
pathname: '',
},
} = props;
const { breadcrumb } = getMenuData(routes, props);
return (
<DocumentTitle
title={getPageTitle({
pathname: location!.pathname,
pathname: location.pathname,
breadcrumb,
formatMessage,
...props,
})}
>
<div className={styles.container}>
......@@ -77,7 +83,8 @@ class UserLayout extends Component<UserLayoutProps> {
</div>
</DocumentTitle>
);
}
}
};
export default UserLayout;
export default connect(({ settings }: ConnectState) => ({
...settings,
}))(UserLayout);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment