From e6b2d108f49e2dc1d3c825704cb19e5557607420 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 06 八月 2025 10:11:35 +0800
Subject: [PATCH] PDA问题修复
---
main.js | 82 ++++++++++++++++++++++++++++++----------
1 files changed, 61 insertions(+), 21 deletions(-)
diff --git a/main.js b/main.js
index 5013c55..429db57 100644
--- a/main.js
+++ b/main.js
@@ -1,23 +1,63 @@
-import App from './App'
+import App from './App'
+
+// #ifndef VUE3
+import Vue from 'vue'
+Vue.config.productionTip = false
+
+import '@/common/bluetooth.js';
+//鍏ㄥ眬鏁版嵁鐘舵�佺鐞� vuex
+import store from '@/store/index.js';
+Vue.prototype.$store = store;
+//鍏ㄥ眬鍏敤闈欐�佹暟鎹�
+import Mock from '@/common/mock/index.js';
+import toast from "@/common/utils/toast.js"
-// #ifndef VUE3
-import Vue from 'vue'
-// Vue.prototype.baseUrl = "http://localhost:8081/acs"
-Vue.prototype.baseUrl = "http://localhost:8082/xgmwms"
-Vue.config.productionTip = false
-App.mpType = 'app'
-const app = new Vue({
- ...App
-})
-app.$mount()
-// #endif
-
-// #ifdef VUE3
-import { createSSRApp } from 'vue'
-export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
-}
+
+Vue.prototype.$Mock = Mock;
+Vue.prototype.$toast = toast
+
+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.$mount()
+// #endif
+
+// #ifdef VUE3
+import { createSSRApp } from 'vue'
+export function createApp() {
+ const app = createSSRApp(App)
+ return {
+ app
+ }
+}
// #endif
\ No newline at end of file
--
Gitblit v1.9.1