yeardlry
yeardlry
  • 发布:2019-01-18 10:21
  • 更新:2020-02-26 18:53
  • 阅读:20781

uniapp中 使用微信的open-type="getUserInfo" 不能获取到userinfo

分类:uni-app

<button open-type="getUserInfo" bindgetuserinfo="bindgetuserinfo">登录</button>
methods: {
bindgetuserinfo: function(e) {
console.log(e);
}
}

但是在调用中 是会提示说 does not have a method "bindgetuserinfo" to handle event "getuserinfo".
之前是直接使用wx小程序来写的是可以获取info 转到uniapp上面却没有拿到

2019-01-18 10:21 负责人:无 分享
已邀请:
bj_steven

bj_steven

<button
class='testbutton'
open-type="getUserInfo"
@getuserinfo="getuserinfo"
withCredentials="true"
>
获取微信用户信息
</button>

Trust

Trust - 少说废话

@getuserinfo
你的 bind 开头这是微信小程序的写法,uni-app 遵循 Vue 的开发规范/体验。

  • yeardlry (作者)

    好的 谢谢

    2019-01-18 10:53

  • 1***@qq.com

    回复 yeardlry: 应该改成什么样子啊,萌新求助啊 作者大大 你可以贴你的代码出来看看么 感激不尽

    2019-09-04 09:26

Fancye

Fancye

到底要怎么改呢

3***@qq.com

3***@qq.com - fooliker

open-type="getUserInfo" class="buttonName" @getuserinfo="bindGetUserInfo"

这样改 把bind替换成@就可以了

该问题目前已经被锁定, 无法添加新回复