index.js
1009 Bytes
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
import React from 'react';
import {render} from 'react-dom';
import config from './config';
import {BrowserRouter, Route,Switch,HashRouter,hashHistory,browserHistory} from 'react-router-dom';
// import guochaoHome from './view/guochaoHome';
// import top40 from './view/top40';
import Loadable from 'react-loadable';
const guochaoHome = Loadable({
loader: () => import(/* webpackChunkName: "guochaoHome" */'./view/guochaoHome'),
loading(){
return <div></div>
},
});
const top40 = Loadable({
loader: () => import(/* webpackChunkName: "top40" */'./view/top40'),
loading(){
return <div></div>
},
});
const SliderComponent = () => (
<Switch>
<Route exact path={config.routerPath+'/guochao.html'} component={guochaoHome} />
<Route path={config.routerPath+'/top40.html'} component={top40} />
</Switch>
);
render(
<BrowserRouter history={browserHistory}>
<SliderComponent/>
</BrowserRouter>,
document.querySelector("#root")
);