main.ts 851 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { createApp } from 'vue'
  2. import { createPinia } from 'pinia'
  3. import App from './App.vue'
  4. import router from './router'
  5. import * as ElementPlusIconsVue from '@element-plus/icons-vue'
  6. import './assets/base.css'
  7. const app = createApp(App)
  8. for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  9. app.component(key, component)
  10. }
  11. app.use(createPinia())
  12. app.use(router)
  13. /**
  14. * @description: 全局异常捕获,此处只用于调试
  15. * @param {*} err 错误对象
  16. * @param {*} instance 触发该错误的组件实例
  17. * @param {*} info 错误来源类型信息
  18. * @return {*}
  19. */
  20. app.config.errorHandler = (err, instance, info) => {
  21. console.log('-----------------')
  22. console.log('未被捕获的异常')
  23. console.log(err)
  24. console.log(instance)
  25. console.log(info)
  26. console.log('-----------------')
  27. }
  28. app.mount('#app')