// 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 VueRouter from 'vue-router'
// import axios from 'axios'
// import hljs from 'highlight.js'
// import * as echarts from 'echarts'
// 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 cookies from 'vue-cookies'
import App from './App'
import 'highlight.js/styles/github.css'
const env = process.env.NODE_ENV && false
// 生产环境
if (env === 'production') {
try {
// 路由
const router = useRouter(Vue, VueRouter)
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.$echarts = echarts
window.$echarts_w = echarts
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: ''
})
}