main.js 961 字节
Newer Older
yma16's avatar
yma16 已提交
1 2 3 4 5 6
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import cookies from 'vue-cookies'
import hljs from 'highlight.js'
7
import {router, useRouter} from './router'
yma16's avatar
yma16 已提交
8 9 10
import importElementComponents from './importElement'
import importEchartsComponents from './importEchartsComponents'

11 12 13
// 路由
useRouter(Vue)

yma16's avatar
yma16 已提交
14
// 按需引入elementui
15
importElementComponents(Vue)
yma16's avatar
yma16 已提交
16

17 18
// 按需引入echarts
importEchartsComponents(Vue)
yma16's avatar
yma16 已提交
19 20 21 22 23

Vue.config.productionTip = false
Vue.use(cookies)

// Vue.use(hljs)
24
Vue.directive('highlight', function (el) {
yma16's avatar
yma16 已提交
25 26 27 28 29 30 31 32
    const blocks = el.querySelectorAll('pre code')
    blocks.forEach(block => {
        hljs.highlightBlock(block)
    })
})

Vue.prototype.$cookies = cookies

33
Vue.prototype.$cookies.set('user_session', 'null')
yma16's avatar
yma16 已提交
34 35 36 37 38 39

new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
yma16's avatar
yma16 已提交
40
})