main.js 2 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
import langUtils from '@/utils/langUtils';
水落(YangLei)'s avatar
水落(YangLei) committed
15
import { en_US, zh_CN } from '@/local';
16 17 18 19

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

import 'moment/locale/zh-cn';

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

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

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

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

const localeLang = langUtils.get();

wb-ct393452's avatar
wb-ct393452 committed
43
const i18n = new VueI18n({
44
    locale: localeLang,
45
    fallbackLocale: langUtils.fallbackLocale,
46
    silentFallbackWarn: true,
水落(YangLei)'s avatar
水落(YangLei) committed
47
    messages: { zh_CN, en_US },
wb-ct393452's avatar
wb-ct393452 committed
48
});
49

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

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

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

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

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

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