小程序获取用户授权
<button @click="getuserinfo">授权登录</button> // 获取用户授权信息 getuserinfo(e) { uni.getUserProfile({ desc: "获取你的昵称、头像、地区及性别", success: (res) => { this.getUserId(res.userInfo.avatarUrl, res.userInfo.nickName); }, fail: (res) => { //拒绝授权 uni.showToast({ title: "您拒绝了请求,不能正常使用小程序", icon: "error", duration: 2000, }); return; }, }); },
本文来自博客园,作者:小万子呀,转载请注明原文链接:https://www.cnblogs.com/newBugs/p/16115335.html