From 043677735668e8b9d95c4060d487d816fec63bb1 Mon Sep 17 00:00:00 2001 From: Ethan_Wan Date: Wed, 4 Jul 2018 10:35:25 +0800 Subject: [PATCH] feat: instead of dva/dynamic using react-loadable --- package.json | 1 + src/router.js | 35 +++++++++++++---------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 89aa770a..3b31160e 100755 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "mockjs": "^1.0.1-beta3", "prettier": "1.13.7", "pro-download": "^1.0.1", + "react-loadable": "^5.4.0", "redbox-react": "^1.5.0", "regenerator-runtime": "^0.12.0", "stylelint": "^9.2.1", diff --git a/src/router.js b/src/router.js index 9cbe5402..36166bd2 100644 --- a/src/router.js +++ b/src/router.js @@ -1,39 +1,30 @@ import React from 'react'; import { routerRedux, Route, Switch } from 'dva/router'; -import { Spin } from 'antd'; -import dynamic from 'dva/dynamic'; import { getRouterData } from './common/router'; import Authorized from './utils/Authorized'; import { getQueryPath } from './utils/utils'; -import { LocalComponent } from './locale/localeContext'; -import styles from './index.less'; const { ConnectedRouter } = routerRedux; const { AuthorizedRoute } = Authorized; -dynamic.setDefaultLoadingComponent(() => { - return ; -}); function RouterConfig({ history, app }) { const routerData = getRouterData(app); const UserLayout = routerData['/user'].component; const BasicLayout = routerData['/'].component; return ( - - - - - } - authority={['admin', 'user']} - redirectPath={getQueryPath('/user/login', { - redirect: window.location.href, - })} - /> - - - + + + + } + authority={['admin', 'user']} + redirectPath={getQueryPath('/user/login', { + redirect: window.location.href, + })} + /> + + ); } -- GitLab