router.js 746 Bytes
Newer Older
1
import React from 'react';
afc163's avatar
afc163 committed
2
import { Router, Route, Switch } from 'dva/router';
afc163's avatar
afc163 committed
3 4
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
WhatAKitty's avatar
WhatAKitty committed
5 6 7 8 9 10 11 12 13 14 15
import dynamic from 'dva/dynamic';

function RouterConfig({ history, app }) {
  const BasicLayout = dynamic({
    app,
    component: () => import('./layouts/BasicLayout'),
  });
  const UserLayout = dynamic({
    app,
    component: () => import('./layouts/UserLayout'),
  });
16 17

  return (
afc163's avatar
afc163 committed
18 19
    <LocaleProvider locale={zhCN}>
      <Router history={history}>
ddcat1115's avatar
ddcat1115 committed
20 21 22 23
        <Switch>
          <Route path="/user" component={UserLayout} />
          <Route path="/" component={BasicLayout} />
        </Switch>
afc163's avatar
afc163 committed
24 25
      </Router>
    </LocaleProvider>
26 27 28 29
  );
}

export default RouterConfig;