提交 22c2db07 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

调整uni.getProvider 的用法。#5843

上级 3a131c6f
...@@ -88,17 +88,17 @@ ...@@ -88,17 +88,17 @@
uni.getProvider({ uni.getProvider({
service: "location", service: "location",
success: (e) => { success: (e) => {
console.log("location success:" + JSON.stringify(e), e.providers.length); console.log("location success:" + JSON.stringify(e), e.providerObjects.length);
let array = e.provider as string[] let array = e.providerIds as string[]
array.forEach((value : string) => { array.forEach((value : string) => {
let locationProvider = e.providers.find((item) : boolean => { let locationProvider = e.providerObjects.find((item) : boolean => {
return item.id == value return item.id == value
}) })
if (locationProvider != null) { if (locationProvider != null) {
this.providerList.push({ this.providerList.push({
name: locationProvider.description, name: locationProvider.description,
id: locationProvider.id, id: locationProvider.id,
provider: e.providers.find((item) : boolean => { provider: e.providerObjects.find((item) : boolean => {
return item.id == locationProvider.id return item.id == locationProvider.id
}) })
} as LocationItem); } as LocationItem);
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
service: "payment", service: "payment",
success: (e) => { success: (e) => {
console.log("payment success:" + JSON.stringify(e)); console.log("payment success:" + JSON.stringify(e));
let array = e.provider as string[] let array = e.providerIds as string[]
array.forEach((value : string) => { array.forEach((value : string) => {
switch (value) { switch (value) {
case 'alipay': case 'alipay':
this.providerList.push({ this.providerList.push({
name: '支付宝', name: '支付宝',
id: "alipay", id: "alipay",
provider: e.providers.find((item) : boolean => { provider: e.providerObjects.find((item) : boolean => {
return item.id == 'alipay' return item.id == 'alipay'
}) })
} as PayItem); } as PayItem);
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
this.providerList.push({ this.providerList.push({
name: '微信', name: '微信',
id: "wxpay", id: "wxpay",
provider: e.providers.find((item) : boolean => { provider: e.providerObjects.find((item) : boolean => {
return item.id == 'wxpay' return item.id == 'wxpay'
}) })
} as PayItem); } as PayItem);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册