2023-02-14 11:50:43 +08:00

37 lines
634 B
JavaScript
Executable File

import Vue from 'vue'
import App from './App'
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({
...App
})
app.$mount()