这里次要用到button的open-type性能,官网已有阐明:


button设置open-type="chooseAvatar",来使bindchooseavatar办法失效,在bindchooseavatar指定的函数中获取用户的头像信息

<button open-type="chooseAvatar"  bindchooseavatar="chooseavatar"></button> chooseavatar(e){    this.setData({      avatar: e.detail.avatarUrl    })},

该办法触发后会自动弹出提示框,让用户抉择头像,用户抉择的头像会在bindchooseavatar指定的函数内获取,e.detail.avatarUrl就是以后的头像信息。
调用批改用户信息接口,传入该门路信息即可。