getuserinfo接口获取失败,这是为何?
发布于 5 年前 作者 zhangping 13354 次浏览 来自 官方Issues

<template>

<button type=“primary” open-type=“getUserInfo” @getuserinfo=“getuserInfo” withCreadentials=“true”>

微信登录

</button>

</template>

<script>

export default{

data:{

 

},

onLoad:function(){

 

},

methods:{

getuserInfo:function(res){

console.log(res);

if(!res.detail.iv){

uni.showToast({

title:“您取消了授权,登录失败”,

icon:“none”

});

return false;

}

}

}

 

}

</script>

<style>

</style>

代码如上

4 回复

你打印出来res是啥?

看看打印的数据res 是什么

sorry, 问题已经fix了,原来是我appid 写错了 囧

建议您在开发者工具里新建一个小程序项目,有源码哟

回到顶部