uniapp如何获取微信和抖音小程序的用户图像及昵称?
网友回复
1、微信小程序之前的getuserprofile已经不能使用,微信官方的解释是:
现在只能使用新方案:
获取微信图像
<button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar">点击获取图像</button>获取昵称
<input type="nickName" class="weui-input" :value="userName" @blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
新的获取微信图像与昵称示例代码:
<template> <view class="containar"> <view class="avatarUrl"> <button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"> <image :src="avatarUrl" class="refreshIcon"></image> </button> </view> <view class="userName"> <text>昵称:</text> <input type="nickName" class="weui-input" :value="userName" @blur="bindblur" placeholder="请输入昵称" @input="bindinput" /> </view> <view class="btn"> <view class="btn-sub" @click="onSubmit">保存</view> </view> </view> </template> <script> export default { data() { return { avatarUrl: '', userName: '' }; }, onLoad(option) {}, methods: { bindblur(e) { this.userName = e.detail.value; // 获取微信昵称 }, bindinput(e) { this.userName = e.detail.value; // 获取微信昵称 }, onChooseavatar(e) { let self = this; let { avatarUrl ...
点击查看剩余70%
抖音小程序还可以使用getUserProfile
tt.getUserProfile({ success: (res) => { console.log('tt.getUserProfile success,获取的用户信息:', res); this.setData({ userI...
点击查看剩余70%
js如何流式输出ai的回答并折叠代码块,点击代码块右侧可预览代码?
ai大模型如何将文章转换成可视化一目了然的图片流程图图表?
大模型生成html版本的ui原型图和ppt演示文档的系统提示词怎么写?
rtsp视频直播流如何转换成websocket流在h5页面上观看?
为啥coze会开源工作流agent coze studio?
如何检测网页是通过收藏夹打开的?
python如何实现类似php的http动态脚本请求处理响应代码?
js如何实现类似php的http动态脚本请求处理响应代码?
trae与solo有啥区别不同?
vue如何让ai动态生成问卷调查多步骤表单式收集基础信息自动规划执行任务?