收藏
回答

chooseAvatar 在获取用户头像时报错,接口问题吗?

小程序端:

<button open-type="chooseAvatarclass="login_imgbindchooseavatar="login_tu">

      <image src="{{userimg}}"></image>

</button>

JS端是这样的:

login_tu: function(e){

        console.log(e.detail);        

        const temp = e.detail.avatarUrl;

}

运行结果是不打印任何数据,直接报错如下:

当前开发者工具版本较旧,对当前版本基础库支持存在问题。请更新开发者工具,或选用更旧版本基础库。(env: Windows,mp,1.06.2405020; lib: 3.12.1)

(anonymous) @ VM7579:1

(anonymous) @ VM7579:1

Error: the type of property "avatarUrl" is illegal

    at X (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at zt.prepare (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at $t.prepare (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at Function._$advancedCreate (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1

    at Object.createComponent (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at dt.createComponentByDef (WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1)

    at c.append (<anonymous>:1:27287)

    at WAServiceMainContext.js?t=wechat&s=1766712678371&v=3.12.1:1

    at Generator.next (<anonymous>)(env: Windows,mp,1.06.2405020; lib: 3.12.1)

导致所有流程不能进行,还没进行任何操作,只要点击button,就弹出报错信息,这个问题困扰了三个月了,之前点击也报错,但在手机上运行是可以的,就没管,现在手机上也不能运行,直接中断了,请帮我分析一下是什么原因

回答关注问题邀请回答
收藏

4 个回答

  • 八九
    八九
    2025-12-26

    有基础库限制,你换一个呢

    2025-12-26
    有用 2
    回复 1
    • 阿慌了神
      阿慌了神
      2025-12-26
      好我换一个
      2025-12-26
      回复
  • 那一抹微笑😊穿透阳光
    那一抹微笑😊穿透阳光
    2025-12-26

    这个是有基础库限制的,应该是你使用的基础库,不满足要求

    2025-12-26
    有用 1
    回复 3
    • 阿慌了神
      阿慌了神
      2025-12-26
      我的基础库是3.12.1版本的,好像切换到低版本如3.6版本就没问题,但如果一直用低版本也不行啊,新出的功能 用不上,所以想彻底解决掉这个问题,在高版本也能使用
      2025-12-26
      回复
    • 那一抹微笑😊穿透阳光
      那一抹微笑😊穿透阳光
      2025-12-26回复阿慌了神
      微信那边有最低使用版本限制,这个没法处理,除非你不用这个获取方式
      2025-12-26
      1
      回复
    • 阿慌了神
      阿慌了神
      2025-12-26
      好,我换一个
      2025-12-26
      回复
  • 阿慌了神
    阿慌了神
    2025-12-26

    <input type="nicknameclass="login_inpname="usernameplaceholder="点击以获取微信昵称maxlength="10"/>

    点击这句话,也是同样的报错,版本是3.12.1

    2025-12-26
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    2025-12-26
    有用
    回复
登录 后发表内容