y***@163.com
y***@163.com
  • 发布:2020-02-26 14:38
  • 更新:2020-03-04 22:09
  • 阅读:1070

button phoneNumber 支付宝授权无法回调

分类:uni-app

<template>
<view class="content">
<button type="default" open-type="getAuthorize" @getAuthorize="onGetAuthorize" @error="onAuthError" scope='phoneNumber'>getPhoneNumber</button>
</view>
</template>

<script>
export default {
data() {
return {
}
},
methods: {
onGetAuthorize(e) {
my.getPhoneNumber({
success: (res) => {
console.log("encryptedData::", res);
},
fail: (err) => {
console.log(err);
console.log('getPhoneNumber_fail');
}
});
},
onAuthError(e) {
console.error(e);
}
}
}
</script>

2020-02-26 14:38 负责人:无 分享
已邀请:
DCloud_uni-ad_HDX

DCloud_uni-ad_HDX

请提供模板代码

6***@qq.com

6***@qq.com

支付宝

<view class="flex flex1" v-if="!userId">  
                                <!-- #ifdef APP-PLUS || MP-TOUTIAO -->  
                                <button class="flex flex1 flex-center text-white" type="primary" @click="getPhoneNumber">{{loginProvider.name|| ''}}注册</button>  
                                <!-- #endif -->  
                                <!-- #ifdef MP-WEIXIN || MP-ALIPAY -->  
                                <button class="flex flex1 flex-center text-white" type="primary" open-type="getPhoneNumber" @getphonenumber="mpGetPhoneNumber">{{loginProvider.name|| ''}}注册</button>  
                                <!-- #endif -->  
                            </view>  

console.log(JSON.stringify(result.detail))  
                if (result.detail.errMsg !== 'getPhoneNumber:ok') {  
                    uni.showModal({  
                        title: '授权提示',  
                        content: '您放弃授权,请输入手机号快速登录',  
                        showCancel: false  
                    });  
                    return;  
                }

一直失败

该问题目前已经被锁定, 无法添加新回复