【微信小程序】通过头像昵称填写能力获取用户头像昵称

微信的wx.getUserProfile接口已发生变更,不再直接提供头像和昵称,现在需要用户手动选择头像并填写昵称。开发者需创建自己的页面来处理这一过程,通过<button>组件触发chooseAvatar事件获取头像,<form>表单收集昵称。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景:wx.getUserProfile接口gg了。淦!
以前直接获取头像昵称;后来强制弹窗,用户授权后获取头像昵称;现在需要用户自己填写头像昵称。。。。还得我们自己写一个页面。。。。
方法:

头像:

<button class="avatar-wrapper" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar">
    <image class="avatar" src="{{avatarUrl}}"></image>
  </button> 

在这里插入图片描述

昵称:

<form catchsubmit="formSubmit">
    <view class="row">
      <view class="text1">昵称:</view>
        <input type="nickname" class="weui-input" name="nickname" placeholder="请输入昵称"/>
    </view>
    <button type="primary" style="margin-top: 40rpx;margin-bottom: 20rpx;" form-type="submit">提交</button>
  </form>

在这里插入图片描述

(谁知道wx.getUserProfile这个接口还有什么luan用吗???)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值