完整代码
<template>
<view style="padding:35px;">
<button type="primary" open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true">微信登录</button>
<button type="primary" open-type="getUserInfo" @click="getuserinfoh5appwx" withCredentials="true">微信登录</button>
<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>