MAIN.ts.ftl 1.8 KB
Newer Older
ibizdev's avatar
ibizdev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
import Vue from 'vue';
import Vuex from 'vuex';
import VueRouter from 'vue-router';
import App from '@/App.vue';

import i18n from '@/locale'

import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant, i18n);

import '@/styles/default.less';

import { ionicInitialize } from '../../../ionic-initialize';
import { ibizMobileComponentsInitialize } from '../../../ibiz-mobile-components-initialize';
ionicInitialize({ mode: 'ios' });
ibizMobileComponentsInitialize();

// 模拟数据
if (process.env.NODE_ENV === 'development') {
    require('@/mock');
}

const pathToRegExp = require('path-to-regexp');
import { AppComponents } from '@/app-register';
import { PageComponents } from './page-register';
import { UserComponent } from '@/user-register';
import store from '@/store';
import router from './router';
import { Interceptors } from '@/utils';
import { ViewOpenService } from '@/utils/view-open-service/view-open-service';

34 35 36 37 38 39 40
// 第三方登登录认证获取用户信息
// import { ThirdPartyService } from '@/ibiz-core/third-party-service/ThirdPartyService';
// const thirdPartyAuth = async () => {
//     await ThirdPartyService.getInstance().login();
// };
// thirdPartyAuth();

ibizdev's avatar
ibizdev committed
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
Vue.config.errorHandler = function (err: any, vm: any, info: any) {
    console.log(err);
}
Vue.config.productionTip = false;
Vue.config.ignoredElements =[/^ion-/, /^ibiz-/];

Vue.use(Vuex);
Vue.use(VueRouter);;

Vue.prototype.$pathToRegExp = pathToRegExp;
Vue.use(AppComponents);
Vue.use(PageComponents);
Vue.use(UserComponent);

router.beforeEach((to: any, from: any, next: any) => {
    if (to.meta && !to.meta.ignoreAddPage) {
        router.app.$store.commit('addPage', to);
    }
    next();
});

Interceptors.getInstance(router, store);
ViewOpenService.getInstance(router);

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