Files
mes-ui-d2/src/main.js
liyang 9007fe59db 简化mock注册方式
优化mock ajax测试页面显示效果


Former-commit-id: 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 9c48d010555e8f55f5a6f57d9d2e65c811dde3c9 [formerly ca2e8994bc1545e1618923b35626d9319fb12fd8]]]]]
Former-commit-id: 6f573879bc4e610763fcb2f7bc37e70cbd6bb99a
Former-commit-id: fb7840d2d437eb5e5caa206b46c18309abfd0b47
Former-commit-id: 6f3841382d90cd623dd01db59e8223d4e36aa601 [formerly 43f2ade1abe6e8d0457cab18402c572f259dd80a]
Former-commit-id: 9d00de3566f053a7fa59a7027555e49fc695a460
Former-commit-id: 4af553c3d1c2803463c03514d8ba6c17bc313ea1
Former-commit-id: 2c638b3c4486b791436fc64cb163de153d8c1146
Former-commit-id: b970f98ee6c4276d2b454796295c5b2fd10ac526
Former-commit-id: fa2af9321d47dd1d0a69357d879f8b5541bead14
2018-08-07 19:08:42 +08:00

109 lines
2.8 KiB
JavaScript

import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
// flex.css
import 'flex.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VCharts from 'v-charts'
import screenfull from 'screenfull'
import contentmenu from 'v-contextmenu'
import 'v-contextmenu/dist/index.css'
import vueJsonTreeView from 'vue-json-tree-view'
import i18n from './i18n'
import util from '@/libs/util.js'
import store from '@/store/index'
import '@/assets/svg-icons'
import '@/components'
import '@/mock'
import '@/plugin/axios'
import pluginLog from '@/plugin/log'
import pluginError from '@/plugin/error'
import pluginImport from '@/plugin/import'
import pluginExport from '@/plugin/export'
import pluginOpen from '@/plugin/open'
// 菜单和路由设置
import router from './router'
import { menuHeader, menuAside } from '@/menu'
import { frameInRoutes } from '@/router/routes'
Vue.use(ElementUI)
Vue.use(VCharts)
Vue.use(contentmenu)
Vue.use(pluginLog)
Vue.use(pluginError)
Vue.use(pluginImport)
Vue.use(pluginExport)
Vue.use(pluginOpen)
Vue.use(vueJsonTreeView)
Vue.config.productionTip = false
Vue.prototype.$env = process.env.NODE_ENV
Vue.prototype.$baseUrl = process.env.BASE_URL
new Vue({
router,
store,
i18n,
render: h => h(App),
created () {
// 处理路由 得到每一级的路由设置
this.getAllPageFromRoutes()
// 设置顶栏菜单
this.$store.commit('d2adminMenuHeaderSet', menuHeader)
},
mounted () {
// D2Admin 开发环境检查更新
util.checkUpdate(this)
// 获取并记录用户 UA
this.$store.commit('d2adminUaGet')
// 展示系统信息
util.showInfo()
// 用户登陆后从数据库加载一系列的设置
this.$store.commit('d2adminLoginSuccessLoad')
// 初始化全屏监听
this.fullscreenListenerInit()
},
watch: {
// 监听路由 控制侧边栏显示
'$route.matched' (val) {
const _side = menuAside.filter(menu => menu.path === val[0].path)
this.$store.commit('d2adminMenuAsideSet', _side.length > 0 ? _side[0].children : [])
}
},
methods: {
/**
* 初始化全屏监听
*/
fullscreenListenerInit () {
if (screenfull.enabled) {
screenfull.on('change', () => {
if (!screenfull.isFullscreen) {
this.$store.commit('d2adminFullScreenSet', false)
}
})
}
},
/**
* 处理路由 得到所有的页面
*/
getAllPageFromRoutes () {
const pool = []
const push = function (routes) {
routes.forEach(route => {
if (route.children) {
push(route.children)
} else {
const { meta, name, path } = route
pool.push({ meta, name, path })
}
})
}
push(frameInRoutes)
this.$store.commit('d2adminPagePoolSet', pool)
}
}
}).$mount('#app')