-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
67 lines (60 loc) · 1.91 KB
/
Copy pathindex.js
File metadata and controls
67 lines (60 loc) · 1.91 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, hashHistory } from 'react-router';
import { Layout } from 'antd';
import SiderBar from './src/global/components/SiderBar/index';
import CustomHeader from './src/global/components/Header/index';
const { Header, Content, Sider } = Layout;
import './src/global/less/global';
export default class CustomLayout extends React.Component {
render() {
return (
<Layout>
<Header>
<CustomHeader />
</Header>
<Layout>
<Sider><SiderBar /></Sider>
<Content>{this.props.children}</Content>
</Layout>
</Layout>
);
}
}
const routes = {
path: '/',
component: CustomLayout,
getIndexRoute(history, callback) {
require.ensure([], function (require) {
callback(null, require('./src/pages/default/index').default);
});
},
getChildRoutes(history, callback) {
if (history.location.pathname === '/hardware') {
require.ensure([], function (require) {
callback(null, [
require('./src/pages/hardware/index').default
]);
});
} else if (history.location.pathname === '/tomcat' || history.location.pathname === '/nginx' || history.location.pathname === '/mysql') {
require.ensure([], function (require) {
callback(null, [
require('./src/pages/tomcat/index').default,
require('./src/pages/nginx/index').default,
require('./src/pages/mysql/index').default
]);
});
} else if (history.location.pathname === '/config' || history.location.pathname === '/threshold') {
require.ensure([], function (require) {
callback(null, [
require('./src/pages/config/index').default,
require('./src/pages/threshold/index').default
]);
});
}
}
}
ReactDOM.render(
<Router history={hashHistory} routes={routes} />,
document.getElementById('app')
);