uniApp处理微信小程序获取用户信息getUserInfo
用微信原生代码应为:
使用 button 组件,并将 open-type 指定为 getUserInfo 类型,获取用户基本信息。
bindgetuserinfo:用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与wx.getUserInfo返回的一致,open-type="getUserInfo"时有效
open-type: getUserInfo获取用户信息,可以从bindgetuserinfo回调中获取到用户信息
然而uniapp中 使用微信的open-type=“getUserInfo” 不能获取到userinfo
在methods 写入方法
在调用中 会提示说 does not have a method “bindgetuserinfo” to handle event “getuserinfo”.
button class='testbutton' open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true"将bindgetuserinfo改成@getuserinfo=“getuserinfo” ,再添加withCredentials=“true”,就可以调用了
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

