main.js 1.93 KB
Newer Older
wb-ct393452's avatar
wb-ct393452 committed
1 2 3 4 5 6 7
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';
8
import { accountModule, settingModule } from './pages/frame/store';
wb-ct393452's avatar
wb-ct393452 committed
9 10
import App from './App.vue';
import Plugins from './plugins';
水落(YangLei)'s avatar
水落(YangLei) committed
11
import { loadGuards, setAppOptions } from './utils/routerUtil';
wb-ct393452's avatar
wb-ct393452 committed
12
import guards from './router/guards';
13
import { loadResponseInterceptor } from './utils/requestUtil';
14 15 16 17 18
import langUtils from '@/utils/langUtils';

import 'tailwindcss/tailwind.css';
import 'animate.css/source/animate.css';
import './theme/index.less';
wb-ct393452's avatar
wb-ct393452 committed
19 20 21

import 'moment/locale/zh-cn';

22
//设置为非生产提示
wb-ct393452's avatar
wb-ct393452 committed
23 24 25
Vue.config.productionTip = false;

//装载Vuex控件
26 27
Vue.use(Vuex);
//加载 框架的module包括 命名空间accountModule,settingModule
wb-ct393452's avatar
wb-ct393452 committed
28
const store = new Vuex.Store({
29
    modules: { accountModule, settingModule },
wb-ct393452's avatar
wb-ct393452 committed
30 31 32 33
});

//装载vue-router控件 如果开发时 不用动态可直接修改这里 isAsynRount=false
Vue.use(Router);
水落(YangLei)'s avatar
水落(YangLei) committed
34
const options = initRouter();
水落(YangLei)'s avatar
水落(YangLei) committed
35
const router = new Router(options);
wb-ct393452's avatar
wb-ct393452 committed
36 37 38

//装载vue-i18n控件 如果语言优先级 请直接修改这里localeLang和fallbackLang
Vue.use(VueI18n);
39 40 41

const localeLang = langUtils.get();

wb-ct393452's avatar
wb-ct393452 committed
42
const i18n = new VueI18n({
43
    locale: localeLang,
44
    fallbackLocale: langUtils.fallbackLocale,
45
    silentFallbackWarn: true,
wb-ct393452's avatar
wb-ct393452 committed
46
});
47

wb-ct393452's avatar
wb-ct393452 committed
48 49 50 51 52 53 54 55 56 57
//装载antd控件
Vue.use(Antd);
//装载Viser;
Vue.use(Viser);
//装载所有插件 VueI18nPlugin,AuthorityPlugin,TabsPagePlugin
Vue.use(Plugins);

//启动引导方法应用启动时需要执行的操作放在这里
//设置应用配置
setAppOptions({ router, store, i18n });
58

wb-ct393452's avatar
wb-ct393452 committed
59 60 61
// 加载路由守卫
loadGuards(guards, { router, store, i18n, message: Vue.prototype.$message });

水落(YangLei)'s avatar
水落(YangLei) committed
62
loadResponseInterceptor({ router });
wb-ct393452's avatar
wb-ct393452 committed
63

水落(YangLei)'s avatar
水落(YangLei) committed
64 65
Vue.prototype.$fileUrl = 'http://platform.kuopu.net:9300/';

wb-ct393452's avatar
wb-ct393452 committed
66
new Vue({
67 68 69 70
    router,
    store,
    i18n,
    render: h => h(App),
wb-ct393452's avatar
wb-ct393452 committed
71
}).$mount('#app');