浏览器手动刷新页面后userInfo.username短时间内变为undefined,导致页面上以userInfo.username为where条件的查询变成了无条件全表查询 想要优雅的实现 等待userInfo.username获取成功后加载页面
2***@qq.com
- 发布:2021-02-14 08:43
- 更新:2021-02-14 23:10
- 阅读:523
2***@qq.com (作者)
在onload里加alert(this.userInfo.username) 我用下面的方法狼狈的解决了
loaddata(){
if(this.userInfo.username!==undefined){
this.getData(1)
}
else{setTimeout(() => {
2021-02-14 23:26