index.js 1009 Bytes
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")
);