0
点赞
收藏
分享

微信扫一扫

Uni-App - 接口 - 第三方登录(H5+ APP)(Hcoder 版)


完整代码

<template>
<view style="padding:35px;">
<!-- #ifdef MP-WEIXIN -->
<button type="primary" open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true">微信登录</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button type="primary" open-type="getUserInfo" @click="getuserinfoh5appwx" withCredentials="true">微信登录</button>
<!-- #endif -->
<button style="margin-top:50px;">手机号码登录</button>
</view>
</template>
<script>
var _self;
export default {
data:{

},
onLoad:function(){
_self = this;
},
methods:{
getuserinfoh5appwx: function(){
uni.login({
success:function(res2){
console.log(JSON.stringify(res2) + '2');
uni.getUserInfo({
success:function(res3){
console.log(JSON.stringify(res3) + '3');
}
})
},
});
}
}
}
</script>
<style>

</style>


举报

相关推荐

0 条评论