// 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 VueRouter from 'vue-router'
// import axios from 'axios'
// import hljs from 'highlight.js'
import useRouter from './router'
import cookies from 'vue-cookies'
import App from './App'
// import importElementComponents from './importElement'
// import importEchartsComponents from './importEchartsComponents'
// 样式
// import 'github-markdown-css/github-markdown.css'
// import 'nprogress/nprogress.css'
import 'highlight.js/styles/github.css'
const env = process.env.NODE_ENV
// 生产环境
if (env === 'production') {
try {
// 路由
const router = useRouter(Vue, VueRouter)
// // 按需引入elementui
// importElementComponents(Vue)
//
// // 按需引入echarts
// importEchartsComponents(Vue)
Vue.config.productionTip = 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.use(axios)
Vue.prototype.$axios = axios
window.$axios_w = axios
Vue.prototype.$cookies.set('user_session', 'null')
new Vue({
el: '#app',
router,
components: { App },
template: ''
})
} catch (e) {
throw Error(e)
}
} else {
// 路由
const router = useRouter(Vue, VueRouter)
// 按需引入elementui
importElementComponents(Vue)
// 按需引入echarts
importEchartsComponents(Vue)
Vue.config.productionTip = 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.use(axios)
Vue.prototype.$axios = axios
window.$axios_w = axios
Vue.prototype.$cookies.set('user_session', 'null')
new Vue({
el: '#app',
router,
components: { App },
template: ''
})
}