main.js 2.14 KB
Newer Older
wb-ct393452's avatar
wb-ct393452 committed
1 2 3 4 5 6 7 8 9
import Vue from 'vue';
import Vuex from 'vuex';
import Antd from 'ant-design-vue';
import Viser from 'viser-vue';
import Router from 'vue-router';
import { initRouter } from './router';
import VueI18n from 'vue-i18n';
import {accountModule, settingModule} from './pages/frame/store';
import App from './App.vue';
10
import "tailwindcss/tailwind.css"
wb-ct393452's avatar
wb-ct393452 committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

import 'animate.css/source/animate.css';
import './theme/index.less';
import Plugins from './plugins';

import { loadRoutes, loadGuards, setAppOptions } from './utils/routerUtil';
import { loadInterceptors } from './utils/requestUtil';
import guards from './router/guards';
import interceptors from './router/interceptors';

import '@/mock';
import 'moment/locale/zh-cn';

//设置为非生产提示 
Vue.config.productionTip = false;

//装载Vuex控件
Vue.use(Vuex)
//加载 框架的module包括 命名空间accountModule,settingModule 
const store = new Vuex.Store({
  modules: {accountModule, settingModule}
});

//装载vue-router控件 如果开发时 不用动态可直接修改这里 isAsynRount=false
Vue.use(Router);
const isAsynRount = store.state.settingModule.asyncRoutes;
const options = initRouter(isAsynRount);
const router = new Router(options);

//装载vue-i18n控件 如果语言优先级 请直接修改这里localeLang和fallbackLang
Vue.use(VueI18n);
//defalt 'CN'
const localeLang = store.state.settingModule.lang;
//default'EN'
const fallbackLang = store.state.settingModule.fallbackLang;
const i18n = new VueI18n({
  locale: localeLang,
  fallbackLocale: fallbackLang,
  silentFallbackWarn: true,
});
 

//装载antd控件
Vue.use(Antd);
//装载Viser;
Vue.use(Viser);
//装载所有插件 VueI18nPlugin,AuthorityPlugin,TabsPagePlugin
Vue.use(Plugins);

//启动引导方法应用启动时需要执行的操作放在这里
//设置应用配置
setAppOptions({ router, store, i18n });
// 加载 axios 拦截器
loadInterceptors(interceptors, { router, store, i18n, message: Vue.prototype.$message });
// 加载路由
loadRoutes();
// 加载路由守卫
loadGuards(guards, { router, store, i18n, message: Vue.prototype.$message });


new Vue({
  router,
  store,
  i18n,
  render: h => h(App),
}).$mount('#app');