From e042325822ddd556f36f58f8e4df81f6515a4111 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期五, 25 四月 2025 10:40:19 +0800 Subject: [PATCH] # --- main.js | 62 +++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/main.js b/main.js new file mode 100644 index 0000000..9b55e09 --- /dev/null +++ b/main.js @@ -0,0 +1,62 @@ +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'; +Vue.prototype.$Mock = Mock; + +import uView from '@/uni_modules/uview-ui' +Vue.use(uView) + +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