import Vue from 'vue'; import App from './App'; import uView from 'uview-ui'; import store from '@/store'; import cache from '@/mixin/cache'; import empty from '@/components/empty'; import tabbar from '@/components/tabbar'; import { router, RouterMount } from '@/router'; //路径换成自己的 import '@/static/iconfont/iconfont.css'; // iconfont的引入 App.mpType = 'app'; Vue.use(router); Vue.use(uView); Vue.mixin(cache); Vue.component('empty', empty); Vue.component('tabbar', tabbar); Vue.config.productionTip = false; App.mpType = 'app'; function isPromise(obj) { return ( !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function' ); } uni.addInterceptor({ returnValue(res) { if (!isPromise(res)) { return res; } return new Promise((resolve, reject) => { res.then(res => { if (res[0]) { reject(res[0]); } else { resolve(res[1]); } }); }); }, }); const app = new Vue({ store, ...App, }); // #ifdef H5 RouterMount(app, router, '#app'); // #endif app.$mount();