编程语言
首页 > 编程语言> > uniapp 关于微信小程序更新API获取用户信息userInfo

uniapp 关于微信小程序更新API获取用户信息userInfo

作者:互联网

uniapp 关于微信小程序更新API获取用户信息userInfo

微信小程序官方公布,4.13以后不再使用getUserInfo方法获取用户信息,更改成getUserProfile,必须用户自己点击才能获取到信息,uniapp官方还未更新用法,目前可用(注:获取code的方法不变,依然可以用uni.login获取):
在这里插入图片描述
在这里插入图片描述

html

<button @click="getUserProfile" > 获取头像昵称 </button>

js

		getUserProfile(){
			const _this=this
			uni.getUserProfile({
				desc: "注册",
				success: (res1) => {
					console.log(res1)
					_this.check()
					_this.getCode()
				},
				fail: (err) => {
					console.log(err)
				}
			})	
		},

标签:uniapp,log,微信,用户,获取,API,getUserProfile
来源: https://blog.csdn.net/weixin_44167504/article/details/115422924