diff --git a/.webpackrc.js b/.webpackrc.js index a96cd18..552ae20 100644 --- a/.webpackrc.js +++ b/.webpackrc.js @@ -18,4 +18,7 @@ export default { alias: { themes: resolve(__dirname, './src/themes'), }, + urlLoaderExcludes: [ + /\.svg$/, + ], } diff --git a/package.json b/package.json index 9c308b3..82614eb 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,8 @@ "eslint-plugin-import": "^2.9.0", "eslint-plugin-jsx-a11y": "^5.1.1", "eslint-plugin-react": "^7.7.0", - "less-vars-to-js": "^1.1.2" + "less-vars-to-js": "^1.1.2", + "svg-sprite-loader": "^3.7.3" }, "pre-commit": [ "lint" diff --git a/src/pages/chart/ECharts/theme/macarons.js b/src/pages/chart/ECharts/theme/macarons.js index 73fc10d..64da22d 100644 --- a/src/pages/chart/ECharts/theme/macarons.js +++ b/src/pages/chart/ECharts/theme/macarons.js @@ -1,7 +1,7 @@ (function (root, factory) { - if (typeof define === 'function' && define.amd) { + if (typeof define === 'function' && define.amd) { // eslint-disable-line // AMD. Register as an anonymous module. - define(['exports', 'echarts'], factory) + define(['exports', 'echarts'], factory) // eslint-disable-line } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(exports, require('echarts')) diff --git a/src/pages/user/components/Filter.js b/src/pages/user/components/Filter.js index 3a02ff9..9b82bad 100644 --- a/src/pages/user/components/Filter.js +++ b/src/pages/user/components/Filter.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types' import moment from 'moment' import { FilterItem } from 'components' import { Form, Button, Row, Col, DatePicker, Input, Cascader, Switch } from 'antd' -import city from '../../utils/city' +import city from 'utils/city' const { Search } = Input const { RangePicker } = DatePicker diff --git a/src/pages/user/components/Modal.js b/src/pages/user/components/Modal.js index 47141a6..ab760a2 100644 --- a/src/pages/user/components/Modal.js +++ b/src/pages/user/components/Modal.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { Form, Input, InputNumber, Radio, Modal, Cascader } from 'antd' -import city from '../../utils/city' +import city from 'utils/city' const FormItem = Form.Item diff --git a/src/router.js b/src/router.js deleted file mode 100644 index 143de89..0000000 --- a/src/router.js +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import { Switch, Route, Redirect, routerRedux } from 'dva/router' -import dynamic from 'dva/dynamic' - -const { ConnectedRouter } = routerRedux - -const Routers = function ({ history, app }) { - const routes = [ - { - path: '/dashboard', - models: () => [import('./models/dashboard')], - component: () => import('./routes/dashboard/'), - }, { - path: '/user', - models: () => [import('./models/user')], - component: () => import('./routes/user/'), - }, { - path: '/user/:id', - models: () => [import('./models/user/detail')], - component: () => import('./routes/user/detail/'), - }, { - path: '/login', - models: () => [import('./models/login')], - component: () => import('./routes/login/'), - }, { - path: '/request', - component: () => import('./routes/request/'), - }, { - path: '/UIElement/iconfont', - component: () => import('./routes/UIElement/iconfont/'), - }, { - path: '/UIElement/search', - component: () => import('./routes/UIElement/search/'), - }, { - path: '/UIElement/dropOption', - component: () => import('./routes/UIElement/dropOption/'), - }, { - path: '/UIElement/layer', - component: () => import('./routes/UIElement/layer/'), - }, { - path: '/UIElement/dataTable', - component: () => import('./routes/UIElement/dataTable/'), - }, { - path: '/UIElement/editor', - component: () => import('./routes/UIElement/editor/'), - }, { - path: '/chart/ECharts', - component: () => import('./routes/chart/ECharts/'), - }, { - path: '/chart/highCharts', - component: () => import('./routes/chart/highCharts/'), - }, { - path: '/chart/Recharts', - component: () => import('./routes/chart/Recharts/'), - }, { - path: '/post', - models: () => [import('./models/post')], - component: () => import('./routes/post/'), - }, - ] - - return ( - - - ()} /> - { - routes.map(({ path, ...dynamics }, key) => ( - - )) - } - - - ) -} - -Routers.propTypes = { - history: PropTypes.object, - app: PropTypes.object, -} - -export default Routers diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..ac4f22d --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,13 @@ + +export default function (webpackConfig) { + webpackConfig.module.rules.push({ + test: /\.svg$/i, + use: [ + { + loader: require.resolve('svg-sprite-loader'), + }, + ], + }) + + return webpackConfig +};