您的位置:首页 > 其它

如何不使用Navigator空间实现跳转页面?

2018-01-05 20:43 369 查看
//引入 Loading页面 主页面 登录页等页面组件
constructor(props) {
super(props);
this.state = { 登录状态: 等待检查 };
}
componentDidMount() {
this.检查登录();    // 比如调用asyncstorage
}
检查登录() {
if(经过检查后是已登录状态) {
this.setState({ 登录状态: 已登录 });
}
else {
this.setState({ 登录状态: 未登录 });
}
}
render() {
const { 登录状态 } = this.state;
switch(登录状态) {
case 等待检查:
return <Loading页面 />;
case 已登录:
return <主页面 />;
case 未登录:
return <登录页 />;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐