From 9a584109ce51621a73f0597f180b3d420ab8cfdb Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 14 Nov 2017 10:46:56 +0800 Subject: [PATCH] Add spin for dynamic import --- src/index.less | 5 +++++ src/router.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index.less b/src/index.less index bd58c5d5..047d86cc 100644 --- a/src/index.less +++ b/src/index.less @@ -7,3 +7,8 @@ body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + +.globalSpin { + width: 100%; + margin: 40px 0 !important; +} diff --git a/src/router.js b/src/router.js index 0000e978..c82ce711 100644 --- a/src/router.js +++ b/src/router.js @@ -1,8 +1,13 @@ import React from 'react'; import { Router, Route, Switch } from 'dva/router'; -import { LocaleProvider } from 'antd'; +import { LocaleProvider, Spin } from 'antd'; import zhCN from 'antd/lib/locale-provider/zh_CN'; import dynamic from 'dva/dynamic'; +import styles from './index.less'; + +dynamic.setDefaultLoadingComponent(() => { + return ; +}); function RouterConfig({ history, app }) { const BasicLayout = dynamic({ -- GitLab