forked from 0x1428571429/microfrontend-base-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserLayout.js
More file actions
51 lines (49 loc) · 1.57 KB
/
UserLayout.js
File metadata and controls
51 lines (49 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React, { Fragment } from 'react'
import { Link, Redirect, Switch, Route } from 'react-router-dom'
import DocumentTitle from 'react-document-title'
import { Icon } from 'antd'
import './UserLayout.less'
import { getRoutes } from '../utils/utils'
class UserLayout extends React.PureComponent {
getPageTitle() {
const { routerData, location } = this.props
const { pathname } = location
let title = '微前端Demo'
if (routerData[pathname] && routerData[pathname].name) {
title = `${routerData[pathname].name} - 微前端Demo`
}
return title
}
render() {
const { routerData, match } = this.props
return (
<DocumentTitle title={this.getPageTitle()}>
<div className='container user-layout'>
<div className='content'>
<div className='top'>
<div className='header'>
<Link to='/'>
{/* <img alt='logo' className={logo} src={logo} /> */}
<span className='title'>微前端Demo</span>
</Link>
</div>
<div className='desc'></div>
</div>
<Switch>
{getRoutes(match.path, routerData).map(item => (
<Route
key={item.key}
path={item.path}
component={item.component}
exact={item.exact}
/>
))}
<Redirect exact from='/user' to='/user/login' />
</Switch>
</div>
</div>
</DocumentTitle>
)
}
}
export default UserLayout