// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
// vue cdn
// import Vue from 'vue'
// import axios from 'axios'
// import hljs from 'highlight.js'
// import importElementComponents from './importElement'
// import importEchartsComponents from './importEchartsComponents'
// 样式cnd
import 'github-markdown-css/github-markdown.css'
import 'nprogress/nprogress.css'
// 无需cdn
import useRouter from './router'
import VueRouter from 'vue-router'
import cookies from 'vue-cookies'
import App from './App'
import 'highlight.js/styles/github.css'
const env = process.env.NODE_ENV && false
// 公共的部分
Vue.use(cookies)
Vue.use(hljs)
Vue.directive('highlight', function (el) {
const blocks = el.querySelectorAll('pre code')
blocks.forEach((block) => {
hljs.highlightBlock(block)
})
})
// cookie
Vue.prototype.$cookies = cookies
// axios
Vue.prototype.$axios = axios
window.$axios_w = axios
Vue.prototype.$cookies.set('user_session', 'null')
// 路由
const router = useRouter(Vue, VueRouter)
// 生产环境
if (env === 'production') {
try {
// 全局引入
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
components: { App },
template: ''
})
} catch (e) {
throw Error(e)
}
} else {
// // 按需引入elementui
// importElementComponents(Vue)
//
// // 按需引入echarts
// importEchartsComponents(Vue)
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
components: { App },
template: ''
})
}