main.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import Vue from 'vue'
  2. import App from '@/App.vue'
  3. import router from '@/router' // api: https://github.com/vuejs/vue-router
  4. import store from '@/store' // api: https://github.com/vuejs/vuex
  5. import VueCookie from 'vue-cookie' // api: https://github.com/alfhen/vue-cookie
  6. import '@/icons' // api: http://www.iconfont.cn/
  7. import '@/assets/scss/index.scss'
  8. import { isAuth } from '@/utils'
  9. import element from '@/element-ui'
  10. import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
  11. Vue.prototype.$http = httpRequest // ajax请求方法
  12. Vue.use(element);
  13. Vue.use(VueCookie);
  14. Vue.config.productionTip = false
  15. // 挂载全局
  16. Vue.prototype.isAuth = isAuth // 权限方法
  17. Vue.prototype.$shortcut = {
  18. notFound() {
  19. return router.replace({ name: "404" })
  20. }
  21. } as Record<string, Function>
  22. // 保存整站vuex本地储存初始状态
  23. // process.env.VUE_APP_RESOURCES_URL['storeState'] = cloneDeep(store.state)
  24. /* eslint-disable no-new */
  25. new Vue({
  26. el: '#app',
  27. router,
  28. store,
  29. render: h => h(App)
  30. })