From fc136b6a2c732d9df2bd49bcdc0b6dbb5e6350df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 5 Jun 2019 17:45:20 +0800 Subject: [PATCH] bugfix: fix #4349,UserLayout getPageTitle doesn't show title --- src/layouts/UserLayout.tsx | 95 ++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/src/layouts/UserLayout.tsx b/src/layouts/UserLayout.tsx index df0890aa..12b66b49 100644 --- a/src/layouts/UserLayout.tsx +++ b/src/layouts/UserLayout.tsx @@ -1,10 +1,11 @@ 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,55 +30,61 @@ const links = [ ]; const copyright = ( - + <> Copyright 2019 蚂蚁金服体验技术部出品 - + ); export interface UserLayoutProps extends ConnectProps { breadcrumbNameMap: { [path: string]: MenuDataItem }; - navTheme: string; } -class UserLayout extends Component { - render() { - const { - route = { - routes: [], - }, - } = this.props; - const { routes = [] } = route; - const { children, location } = this.props; - const { breadcrumb } = getMenuData(routes, this.props); - return ( - -
-
- -
-
-
-
- - logo - Ant Design - -
-
Ant Design 是西湖区最具影响力的 Web 设计规范
+const UserLayout: React.SFC = props => { + const { + route = { + routes: [], + }, + } = props; + const { routes = [] } = route; + const { + children, + location = { + pathname: '', + }, + } = props; + const { breadcrumb } = getMenuData(routes, props); + + return ( + +
+
+ +
+
+
+
+ + logo + Ant Design +
- {children} +
Ant Design 是西湖区最具影响力的 Web 设计规范
- + {children}
- - ); - } -} + +
+
+ ); +}; -export default UserLayout; +export default connect(({ settings }: ConnectState) => ({ + ...settings, +}))(UserLayout); -- GitLab