fix: svg don't work

This commit is contained in:
chencheng
2018-03-24 18:08:16 +08:00
parent fb49056c73
commit 89d22451c5
7 changed files with 22 additions and 94 deletions
+3
View File
@@ -18,4 +18,7 @@ export default {
alias: {
themes: resolve(__dirname, './src/themes'),
},
urlLoaderExcludes: [
/\.svg$/,
],
}
+2 -1
View File
@@ -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"
+2 -2
View File
@@ -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'))
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
-89
View File
@@ -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 (
<ConnectedRouter history={history}>
<Switch>
<Route exact path="/" render={() => (<Redirect to="/dashboard" />)} />
{
routes.map(({ path, ...dynamics }, key) => (
<Route key={key}
exact
path={path}
component={dynamic({
app,
...dynamics,
})}
/>
))
}
</Switch>
</ConnectedRouter>
)
}
Routers.propTypes = {
history: PropTypes.object,
app: PropTypes.object,
}
export default Routers
+13
View File
@@ -0,0 +1,13 @@
export default function (webpackConfig) {
webpackConfig.module.rules.push({
test: /\.svg$/i,
use: [
{
loader: require.resolve('svg-sprite-loader'),
},
],
})
return webpackConfig
};