//登录缓存方法
uni.setStorage({//缓存用户登陆状态
key: 'userInfo',
data: userdata
})
onLaunch: function() {
console.log('userInfo', uni.getStorageSync('userInfo'));
let userInfo = uni.getStorageSync('userInfo') || '';
if(userInfo.id){
//更新登陆状态
uni.getStorage({
key: 'userInfo',
success: (res) => {
this.login(res.data);
}
});
}
}