import './assets/css/main.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router/index.js'
import Antd from 'ant-design-vue';
import {message} from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
// import './assets/css/iconfont.css';
import G from './utils/common'

router.onError((error) => {

  console.log("路由报错")

  const pattern = /net::ERR_ABORTED 404 (Not Found)/g;
  const err = /Failed to fetch dynamically/g;
  const isChunkLoadFailed = error.message.match(pattern);
  const isChunkLoadFailedErr = error.message.match(err);
  if (isChunkLoadFailed || isChunkLoadFailedErr) {
    message.error('系统已升级，正在刷新本地存储，请稍候...');
    setTimeout(()=>{
     location.reload();
    },2000)
  }
});
const app = createApp(App)
app.config.globalProperties.G = G
app.use(createPinia())
app.use(router)
app.use(Antd)
app.mount('#app')


