删除elementui 改用cdn方式加载

This commit is contained in:
zyy 2019-11-14 14:10:20 +08:00
parent f31026608a
commit 558f359c77
10 changed files with 72 additions and 71 deletions

View File

@ -16,7 +16,6 @@
}, },
"dependencies": { "dependencies": {
"axios": "0.18.0", "axios": "0.18.0",
"element-ui": "2.7.2",
"file-saver": "^1.3.3", "file-saver": "^1.3.3",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.png"> <link rel="icon" href="<%= BASE_URL %>favicon.png">
<!-- <link rel="stylesheet" href="https://cdn.bootcss.com/element-ui/2.12.0/theme-chalk/index.css"> --> <link rel="stylesheet" href="https://cdn.bootcss.com/element-ui/2.12.0/theme-chalk/index.css">
<link href="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<script src="/static/inflate.min.js"></script> <script src="/static/inflate.min.js"></script>
@ -17,9 +17,9 @@
<script src="https://cdn.bootcss.com/vue-router/3.0.6/vue-router.min.js"></script> <script src="https://cdn.bootcss.com/vue-router/3.0.6/vue-router.min.js"></script>
<script src="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script> <script src="https://cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>
<!-- <script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script> <script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/en.min.js"></script> <script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/en.min.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/zh-CN.min.js"></script> --> <script src="https://cdn.bootcss.com/element-ui/2.12.0/locale/zh-CN.min.js"></script>
</head> </head>
<body> <body>
<noscript> <noscript>

View File

@ -1,4 +1,5 @@
import enLocale from 'element-ui/lib/locale/lang/en'; // import enLocale from 'element-ui/lib/locale/lang/en';
import ELEMENT from 'element-ui';
import map from './map'; import map from './map';
import global from './global'; import global from './global';
import router from './router'; import router from './router';
@ -30,34 +31,34 @@ import login from './login';
import designPlatform from './designPlatform'; import designPlatform from './designPlatform';
export default { export default {
...enLocale, ...ELEMENT.lang.en,
map, map,
global, global,
router, router,
lesson, lesson,
teach, teach,
error, error,
rules, rules,
scriptRecord, scriptRecord,
tip, tip,
system, system,
orderAuthor, orderAuthor,
publish, publish,
permission, permission,
replay, replay,
planMonitor, planMonitor,
screenMonitor, screenMonitor,
demonstration, demonstration,
exam, exam,
dashboard, dashboard,
jlmap3d, jlmap3d,
display, display,
joinTraining, joinTraining,
trainRoom, trainRoom,
menu, menu,
ibp, ibp,
approval, approval,
systemGenerate, systemGenerate,
login, login,
designPlatform designPlatform
}; };

View File

@ -1,4 +1,5 @@
import cnLocale from 'element-ui/lib/locale/lang/zh-CN'; // import cnLocale from 'element-ui/lib/locale/lang/zh-CN';
import ELEMENT from 'element-ui';
import map from './map'; import map from './map';
import global from './global'; import global from './global';
import router from './router'; import router from './router';
@ -30,7 +31,7 @@ import login from './login';
import designPlatform from './designPlatform'; import designPlatform from './designPlatform';
export default { export default {
...cnLocale, ...ELEMENT.lang.zhCN,
map, map,
global, global,
router, router,

View File

@ -1,10 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
import 'normalize.css/normalize.css'; // A modern alternative to CSS resets import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
import ELEMENT from 'element-ui';
import ElementUI from 'element-ui';
import ElementLocale from 'element-ui/lib/locale';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss'; // global css import '@/styles/index.scss'; // global css
@ -26,7 +23,7 @@ import '@/directive/quickMenuDrag/index.js';
import '@/directive/waves/index.js'; import '@/directive/waves/index.js';
import messages from '@/i18n/index'; import messages from '@/i18n/index';
Vue.use(ElementUI); Vue.use(ELEMENT);
Vue.use(VueI18n); Vue.use(VueI18n);
Vue.config.productionTip = false; Vue.config.productionTip = false;
@ -36,7 +33,7 @@ export const i18n = new VueI18n({
messages messages
}); });
ElementLocale.i18n((key, value) => i18n.t(key, value)); ELEMENT.i18n((key, value) => i18n.t(key, value));
new Vue({ new Vue({
el: '#app', el: '#app',

View File

@ -30,6 +30,7 @@ const ExistingSimulation = () => import('@/views/system/existingSimulation/index
const CacheControl = () => import('@/views/system/cacheControl/index'); const CacheControl = () => import('@/views/system/cacheControl/index');
const SystemGenerate = () => import('@/views/system/systemGenerate/index'); const SystemGenerate = () => import('@/views/system/systemGenerate/index');
const IbpDraw = () => import('@/views/system/ibpDraw/index'); const IbpDraw = () => import('@/views/system/ibpDraw/index');
const News = () => import('@/views/system/news/index');
const Mapedit = () => import('@/views/mapdraft/index'); const Mapedit = () => import('@/views/mapdraft/index');
@ -99,7 +100,6 @@ const UserRulesDetail = () => import('@/views/orderauthor/rules/detail');
const LessonApproval = () => import('@/views/approval/lesson/index'); const LessonApproval = () => import('@/views/approval/lesson/index');
const ScriptApproval = () => import('@/views/approval/script/index'); const ScriptApproval = () => import('@/views/approval/script/index');
const RunPlanApproval = () => import('@/views/approval/runPlan/index'); const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const News = () => import('@/views/news/index');
import { loginTitle } from '@/scripts/ConstDic'; import { loginTitle } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';

View File

@ -15,6 +15,7 @@ import { Notification } from 'element-ui';
import { runDiagramIsStart, runDiagramGetTime, runDiagramOver, runDiagramStart } from '@/api/simulation'; import { runDiagramIsStart, runDiagramGetTime, runDiagramOver, runDiagramStart } from '@/api/simulation';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
//
export default { export default {
name: 'MenuPlan', name: 'MenuPlan',
components: { components: {

View File

@ -16,6 +16,7 @@
import { prefixIntrger } from '@/utils/date'; import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index'; import SystemTime from '@/views/components/systemTime/index';
//
export default { export default {
name: 'MenuSystemTime', name: 'MenuSystemTime',
components: { components: {

View File

@ -81,7 +81,8 @@ module.exports = {
'vuex': 'Vuex', 'vuex': 'Vuex',
'vue-router': 'VueRouter', 'vue-router': 'VueRouter',
'nprogress': 'NProgress', 'nprogress': 'NProgress',
'echarts': 'echarts' 'echarts': 'echarts',
'element-ui': 'ELEMENT'
}; };
}, },
@ -144,39 +145,39 @@ module.exports = {
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: 'initial' // only package third parties that are initially dependent
}, },
elementUI: { // elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package // name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app // priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm // test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
}, // },
commons: { commons: {
name: 'chunk-commons', name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true
},
jmap: {
name: 'chunk-jmap',
test: resolve('src/jmap'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
},
jlmap3d: {
name: 'chunk-jlmap3d',
test: resolve('src/jlmap3d'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
},
ibp: {
name: 'chunk-ibp',
test: resolve('src/ibp'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
} }
// jmap: {
// name: 'chunk-jmap',
// test: resolve('src/jmap'), // can customize your rules
// minChunks: 3, // minimum common number
// priority: 5,
// reuseExistingChunk: true
// },
// jlmap3d: {
// name: 'chunk-jlmap3d',
// test: resolve('src/jlmap3d'), // can customize your rules
// minChunks: 3, // minimum common number
// priority: 5,
// reuseExistingChunk: true
// },
// ibp: {
// name: 'chunk-ibp',
// test: resolve('src/ibp'), // can customize your rules
// minChunks: 3, // minimum common number
// priority: 5,
// reuseExistingChunk: true
// }
} }
}); });
config.optimization.runtimeChunk('single'); config.optimization.runtimeChunk('single');