微信小程序開發,uniapp 開發微信小程序如何授權用戶信息

 2023-12-06 阅读 30 评论 0

摘要:<template><view class="content"><view @click="wxGetUserInfo">授權信息</view><button class="bottoms" type="primary" open-type="getPhoneNumber" withCredentials=&#
<template><view class="content"><view @click="wxGetUserInfo">授權信息</view><button class="bottoms" type="primary" open-type="getPhoneNumber" withCredentials="true"lang="zh_CN"@getphonenumber="getPhoneNumber">手機授權</button></view>
</template><script>export default {data() {return {}},onLoad() {},methods: {// 授權手機號碼信息getPhoneNumber(e) {console.log(e,'---e----')if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {console.log('用戶拒絕提供手機號');} else {console.log('用戶同意提供手機號');}},// 授權用戶信息wxGetUserInfo(){let that = thiswx.getUserProfile({desc: "獲取你的昵稱、頭像、地區及性別",success: (infoRes) => {console.log(infoRes,'----信息---')},})},}}
</script><style scoped lang="less"></style>

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://808629.com/192176.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 86后生记录生活 Inc. 保留所有权利。

底部版权信息