sijun.li | 9646230 | 2020-07-24 10:08:05 +0800 | [diff] [blame^] | 1 | import Vue from 'vue' |
| 2 | |
| 3 | import Cookies from 'js-cookie' |
| 4 | |
| 5 | import 'normalize.css/normalize.css' // a modern alternative to CSS resets |
| 6 | |
| 7 | import Element from 'element-ui' |
| 8 | import './styles/element-variables.scss' |
| 9 | import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖 |
| 10 | |
| 11 | import '@/styles/index.scss' // global css |
| 12 | |
| 13 | import App from './App' |
| 14 | import store from './store' |
| 15 | import router from './router' |
| 16 | |
| 17 | import './icons' // icon |
| 18 | import './permission' // permission control |
| 19 | import './utils/error-log' // error log |
| 20 | |
| 21 | import * as filters from './filters' // global filters |
| 22 | |
| 23 | /** |
| 24 | * If you don't want to use mock-server |
| 25 | * you want to use MockJs for mock api |
| 26 | * you can execute: mockXHR() |
| 27 | * |
| 28 | * Currently MockJs will be used in the production environment, |
| 29 | * please remove it before going online ! ! ! |
| 30 | */ |
| 31 | if (process.env.NODE_ENV === 'production') { |
| 32 | const { mockXHR } = require('../mock') |
| 33 | mockXHR() |
| 34 | } |
| 35 | |
| 36 | Vue.use(Element, { |
| 37 | size: Cookies.get('size') || 'medium', // set element-ui default size |
| 38 | locale: enLang // 如果使用中文,无需设置,请删除 |
| 39 | }) |
| 40 | |
| 41 | // register global utility filters |
| 42 | Object.keys(filters).forEach(key => { |
| 43 | Vue.filter(key, filters[key]) |
| 44 | }) |
| 45 | |
| 46 | Vue.config.productionTip = false |
| 47 | |
| 48 | new Vue({ |
| 49 | el: '#app', |
| 50 | router, |
| 51 | store, |
| 52 | render: h => h(App) |
| 53 | }) |