49. Login page _ get user information
pages\login\index.json
{
"usingComponents": {
},
"navigationBarTitleText": "登录"
}
pages\login\index.wxml
<button type="primary" plain>登录</button>
pages\login\index.wxss
button{
margin-top: 40rpx;
width: 70%;
}
Get user information
<button type="primary" plain open-type="getUserInfo" bindgetuserinfo="handleGetUserInfo">登录</button>
pages\login\index.js
Page({
handleGetUserInfo(e){
//console.log(e);
const {
userInfo}=e.detail;
wx.setStorageSync( "userinfo", userInfo);
wx.navigateBack({
delta: 1
});
}
})
pages\user\index.wxml
<navigator url="/pages/login/index">登录</navigator>
Clear all caches——>From the personal center (there is nothing in the Storage storage cache)——>Login——>Jump to the login page——>Login button——>WeChat permission allowed (there is also data in the cache at this time ) The
login page function is completed