import '@babel/polyfill/dist/polyfill.min.js' ; import { message } from 'ant-design-vue' ; import Vue from 'vue' ; import localStore from '@/localStore' ; import createThemeColorCss from '@/utils/createThemeColorCss' ; import enableRouterLocalStore from '@/utils/enableRouterLocalStore' ; import validateAuth from '@/utils/validateLogin' ; import App from './App' ; import store from '@/store' ; import router from './router' ; import locale from '@/locale' ; import '@/style/reset.css' ; import '@/style/index.css' ; window . _enableRouterLocalStore = null ; Vue . config . productionTip = false ; Vue . prototype . $locale = locale ; Vue . prototype . $message = message ; createThemeColorCss ( store ) ; const initAPP = async ( ) => { const len = await localStore . length ( ) . then ( len => len ) ; const enableRouterCache = store . state . routerLocalStore ; if ( enableRouterCache && len > 0 ) { localStore . ready ( ) . then ( ( ) => { localStore . iterate ( ( state , moduleName , idx ) => { try { if ( ( store as any ) . _mutations [ `${ moduleName }/EXTENDS_LOCAL_STORE` ] ) store . commit ( `${ moduleName }/EXTENDS_LOCAL_STORE` , state ) ; } catch ( e ) { console . error ( e ) ; return new Vue ( { router , store , render : h => h ( App ) } ) . $mount ( '#root' ) ; } if ( idx === len ) { new Vue ( { router , store , render : h => h ( App ) } ) . $mount ( '#root' ) ; } } ) ; } ) ; } else { new Vue ( { router , store , render : h => h ( App ) } ) . $mount ( '#root' ) ; } if ( enableRouterCache ) window . _enableRouterLocalStore = enableRouterLocalStore ( store ) ; } ; initAPP ( ) ; validateAuth ( store , router ) ;