main.js 838 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import router from './router'
  4. import singleSpaVue from 'single-spa-vue'
  5. import { Loading } from 'element-ui'
  6. import '@/utils/'
  7. import axios from 'axios'
  8. Vue.use(Loading.directive)
  9. Vue.config.productionTip = false
  10. router.afterEach((to, from) => {
  11. axios.get(process.env.VUE_APP_LOG_URL + process.env.VUE_APP_BASE_URL + to.fullPath)
  12. })
  13. const vueOptions = {
  14. el: '#single-spa-app',
  15. router,
  16. render: (h) => h(App)
  17. }
  18. let vueLifecycles = {}
  19. if (process.env.VUE_APP_ALONE) {
  20. delete vueOptions.el
  21. new Vue(vueOptions).$mount('#app')
  22. } else {
  23. vueLifecycles = singleSpaVue({
  24. Vue,
  25. appOptions: vueOptions
  26. })
  27. }
  28. export const bootstrap = vueLifecycles.bootstrap
  29. export const mount = vueLifecycles.mount
  30. export const unmount = vueLifecycles.unmount
  31. export default vueLifecycles