From 1af09aed6c9e0173670f860cc3bc738d3198f65f Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Tue, 13 Aug 2024 13:11:17 +0800 Subject: [PATCH] =?UTF-8?q?[provider]=E6=B7=BB=E5=8A=A0getProviderSync=20?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/provider/provider.uvue | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/pages/API/provider/provider.uvue b/pages/API/provider/provider.uvue index f53645ec..2acaf988 100644 --- a/pages/API/provider/provider.uvue +++ b/pages/API/provider/provider.uvue @@ -48,24 +48,28 @@ { service: "location", name: "定位", provider: [], providerObj: [], providerObjMap: [] } ] as ProviderItem[], providerIds: [] as string[], - providerObjects : [] as UniProvider[], + providerObjects: [] as UniProvider[], } }, methods: { getProvider() { this.serviceList.forEach((item : ProviderItem) => { - uni.getProvider({ + var provider = uni.getProviderSync({ service: item.service, - success: (e) => { - e.providerIds.forEach((value) => { - this.providerIds.push(value) - }) - this.updateProvider(item.service, e.providerIds, e.providerObjects); - }, - fail: (e) => { - console.log("获取provider失败:", e); - } - } as GetProviderOptions) + // success: (e) => { + // // e.providerIds.forEach((value) => { + // // this.providerIds.push(value) + // // }) + // // this.updateProvider(item.service, e.providerIds, e.providerObjects); + // }, + // fail: (e) => { + // console.log("获取provider失败:", e); + // } + } as GetProviderSyncOptions) + provider.providerIds.forEach((value) => { + this.providerIds.push(value) + }) + this.updateProvider(item.service, provider.providerIds, provider.providerObjects); }) }, updateProvider(service : string, provider ?: string[] | null, uniProvider : UniProvider[]) { @@ -77,7 +81,7 @@ item.providerObj = uniProvider item.providerObj.forEach((obj) => { - this.providerObjects.push(obj) + this.providerObjects.push(obj) // #ifdef APP-ANDROID if (obj instanceof UniPaymentWxpayProvider) {//判断微信是否安装 var isWeChatInstalled = (obj as UniPaymentWxpayProvider).isWeChatInstalled @@ -155,4 +159,4 @@ .btn-get-provider { margin-top: 30px; } - + \ No newline at end of file -- GitLab