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%
python如何调用openai的api实现知识讲解类动画讲解视频的合成?
html如何直接调用openai的api实现海报可视化设计及文本描述生成可编辑海报?
f12前端调试如何找出按钮点击事件触发的那段代码进行调试?
abcjs如何将曲谱播放后导出mid和wav格式音频下载?
python如何将曲子文本生成音乐mp3或wav、mid文件
python中mp3、wav音乐如何转成mid格式?
js在HTML中如何将曲谱生成音乐在线播放并下载本地?
python如何实现在windows上通过键盘来模拟鼠标操作?
python如何给win10电脑增加文件或文件夹右键自定义菜单?
python如何将音乐mp3文件解析获取曲调数据?