You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<template>
|
|
|
|
<view class="container">
|
|
|
|
<button class="confirm-btn" @click="login1">微信授权登录</button>
|
|
|
|
<view class="v">
|
|
|
|
{{text}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
login1() {
|
|
|
|
uni.login({
|
|
|
|
provider: 'weixin',
|
|
|
|
success: function (loginRes) {
|
|
|
|
console.log(loginRes);
|
|
|
|
// 获取用户信息
|
|
|
|
uni.getUserInfo({
|
|
|
|
provider: 'weixin',
|
|
|
|
success: function (infoRes) {
|
|
|
|
console.log('用户昵称为:' + JSON.stringify(infoRes));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.v {
|
|
|
|
white-space: normal;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
|
|
|
</style>
|