From 677621d7c17a1d85e2e334286480443c34ce9959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Wed, 4 Jul 2018 10:27:08 +0800 Subject: [PATCH] mv index.* to global.* --- src/global.js | 31 +++++++++++++++++++++++++++++++ src/global.less | 33 +++++++++++++++++++++++++++++++++ src/index.js | 29 ----------------------------- src/index.less | 31 ------------------------------- src/utils/request.js | 7 ++++++- 5 files changed, 70 insertions(+), 61 deletions(-) create mode 100644 src/global.js create mode 100644 src/global.less delete mode 100644 src/index.js diff --git a/src/global.js b/src/global.js new file mode 100644 index 00000000..21b0b4a6 --- /dev/null +++ b/src/global.js @@ -0,0 +1,31 @@ +import './polyfill'; + +// TODO remove +// import dva from 'dva'; + +// import createHistory from 'history/createHashHistory'; +// // user BrowserHistory +// // import createHistory from 'history/createBrowserHistory'; +// import createLoading from 'dva-loading'; +// import 'moment/locale/zh-cn'; +// import './rollbar'; + +// import './index.less'; +// // 1. Initialize +// const app = dva({ +// history: createHistory(), +// }); + +// // 2. Plugins +// app.use(createLoading()); + +// // 3. Register global model +// app.model(require('./models/global').default); + +// // 4. Router +// app.router(require('./router').default); + +// // 5. Start +// app.start('#root'); + +// export default app._store; // eslint-disable-line diff --git a/src/global.less b/src/global.less new file mode 100644 index 00000000..d7b0d770 --- /dev/null +++ b/src/global.less @@ -0,0 +1,33 @@ +html, +body, +#root { + height: 100%; +} + +.colorWeak { + filter: invert(80%); +} + +.ant-layout { + min-height: 100vh; +} + +canvas { + display: block; +} + +body { + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.globalSpin { + width: 100%; + margin: 40px 0 !important; +} + +// temp fix for https://github.com/ant-design/ant-design/commit/a1fafb5b727b62cb0be29ce6e9eca8f579d4f8b7 +.ant-spin-container { + overflow: visible !important; +} diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 27a33c83..00000000 --- a/src/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import './polyfill'; -import dva from 'dva'; - -import createHistory from 'history/createHashHistory'; -// user BrowserHistory -// import createHistory from 'history/createBrowserHistory'; -import createLoading from 'dva-loading'; -import 'moment/locale/zh-cn'; -import './rollbar'; - -import './index.less'; -// 1. Initialize -const app = dva({ - history: createHistory(), -}); - -// 2. Plugins -app.use(createLoading()); - -// 3. Register global model -app.model(require('./models/global').default); - -// 4. Router -app.router(require('./router').default); - -// 5. Start -app.start('#root'); - -export default app._store; // eslint-disable-line diff --git a/src/index.less b/src/index.less index 1d52092a..846192ff 100644 --- a/src/index.less +++ b/src/index.less @@ -1,35 +1,4 @@ -html, -body, -:global(#root) { - height: 100%; -} - -:global(.colorWeak) { - filter: invert(80%); -} - -:global(.ant-layout) { - min-height: 100vh; -} - -canvas { - display: block; -} - -body { - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - .globalSpin { width: 100%; margin: 40px 0 !important; } - -// temp fix for https://github.com/ant-design/ant-design/commit/a1fafb5b727b62cb0be29ce6e9eca8f579d4f8b7 -:global { - .ant-spin-container { - overflow: visible !important; - } -} diff --git a/src/utils/request.js b/src/utils/request.js index 80e495ea..efe1c532 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,7 +1,12 @@ import fetch from 'dva/fetch'; import { notification } from 'antd'; import { routerRedux } from 'dva/router'; -import store from '../index'; + +// TODO set store +// import store from '../global'; +const store = { + dispatch: () => {}, +}; const codeMessage = { 200: '服务器成功返回请求的数据。', -- GitLab