main.js 1.27 KB
Newer Older
Z's avatar
Z committed
1
// Vue
xulili's avatar
xulili committed
2
import Vue from 'vue'
Z's avatar
Z committed
3 4 5 6 7 8 9
import i18n from './i18n'
import App from './App'
// 核心插件
import d2Admin from '@/plugin/d2admin'
// store
import store from '@/store/index'

Z's avatar
Z committed
10 11 12 13 14
// Z-VCharts
import VCharts from 'v-charts'



Z's avatar
Z committed
15
// 菜单和路由设置
xulili's avatar
xulili committed
16
import router from './router'
Z's avatar
Z committed
17 18 19
import menuHeader from '@/menu/header'
import menuAside from '@/menu/aside'
import { frameInRoutes } from '@/router/routes'
xulili's avatar
xulili committed
20

Z's avatar
Z committed
21 22
// 核心插件
Vue.use(d2Admin)
Z's avatar
Z committed
23
Vue.use(VCharts)
xulili's avatar
xulili committed
24 25 26 27

new Vue({
  router,
  store,
Z's avatar
Z committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  i18n,
  render: h => h(App),
  created () {
    // 处理路由 得到每一级的路由设置
    this.$store.commit('d2admin/page/init', frameInRoutes)
    // 设置顶栏菜单
    this.$store.commit('d2admin/menu/headerSet', menuHeader)
    // 设置侧边栏菜单
    this.$store.commit('d2admin/menu/asideSet', menuAside)
    // 初始化菜单搜索功能
    this.$store.commit('d2admin/search/init', menuHeader)
  },
  mounted () {
    // 展示系统信息
    this.$store.commit('d2admin/releases/versionShow')
    // 用户登录后从数据库加载一系列的设置
    this.$store.dispatch('d2admin/account/load')
    // 获取并记录用户 UA
    this.$store.commit('d2admin/ua/get')
    // 初始化全屏监听
    this.$store.dispatch('d2admin/fullscreen/listen')
  }
xulili's avatar
xulili committed
50
}).$mount('#app')