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%
腾讯混元模型广场里都是混元模型的垂直小模型,如何api调用?
为啥所有的照片分辨率提升工具都会修改照片上的图案细节?
js如何在浏览器中将webm视频的声音分离为单独音频?
微信小程序如何播放第三方域名url的mp4视频?
ai多模态大模型能实时识别视频中的手语为文字吗?
如何远程调试别人的chrome浏览器获取调试信息?
为啥js打开新网页window.open设置窗口宽高无效?
浏览器中js的navigator.mediaDevices.getDisplayMedia屏幕录像无法录制SpeechSynthesisUtterance产生的说话声音?
js中mediaRecorder如何录制window.speechSynthesis声音音频并下载?
python如何直接获取抖音短视频的音频文件url?