From d1637ba45da765197505b704ff4625a8b2ffdef6 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 27 四月 2023 16:22:18 +0800
Subject: [PATCH] #
---
main.js | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/main.js b/main.js
index ebe6446..af98bb7 100644
--- a/main.js
+++ b/main.js
@@ -2,13 +2,39 @@
// #ifndef VUE3
import Vue from 'vue'
-// Vue.prototype.baseUrl = "http://localhost:8081/acs"
-Vue.prototype.baseHttp = 'http://'
-Vue.prototype.baseUrl = ':8082/xgmwms'
Vue.config.productionTip = false
App.mpType = 'app'
+
+try {
+ function isPromise(obj) {
+ return (
+ !!obj &&
+ (typeof obj === "object" || typeof obj === "function") &&
+ typeof obj.then === "function"
+ );
+ }
+
+ // 缁熶竴 vue2 API Promise 鍖栬繑鍥炴牸寮忎笌 vue3 淇濇寔涓�鑷�
+ 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]);
+ }
+ });
+ });
+ },
+ });
+} catch (error) { }
+
const app = new Vue({
- ...App
+ ...App
})
app.$mount()
// #endif
--
Gitblit v1.9.1