alita icon indicating copy to clipboard operation
alita copied to clipboard

alita路由多Tab和无Tab如何混用?

Open gitspringcould opened this issue 5 years ago • 8 comments

alita路由多Tab和无Tab如何混用,比如登录跳转到Tab页

gitspringcould avatar Oct 17 '19 01:10 gitspringcould

关于tab混用,由于原生小程序不支持所以alita也支持不了。 不过这个场景,可以用如下的方式,这样login页的底部tab是不显示的


class Page extends Component {
    
    componentDidMount() {
        if (!isLogin) {
            history.push('login')
        }
    }

    render() {
        if (!isLogin) {
            return null
        }
        
        return (
            <View>...</View>
        )
    }
}

ykforerlang avatar Oct 17 '19 01:10 ykforerlang

能给一个具体的例子吗?

gitspringcould avatar Oct 17 '19 01:10 gitspringcould

/examples/HelloWorldExpo。 类似这个例子,你可以把A页看成是你的主页, C页看成是登陆页,在A页的didMount方法里面,直接调用 history.push('C'),

ykforerlang avatar Oct 17 '19 02:10 ykforerlang

r 报这个错 什么原因呢

gitspringcould avatar Oct 17 '19 02:10 gitspringcould

@gitspringcould 我看了下小程序跳转了, RN报错了, 正在定位。。。:smile::smile::smile:

ykforerlang avatar Oct 17 '19 03:10 ykforerlang

好的,辛苦了

gitspringcould avatar Oct 17 '19 03:10 gitspringcould

暂时可以把 跳转语句加到: componentDidFocus

 componentDidFocus() {
        history.push('C')
  }

ykforerlang avatar Oct 17 '19 03:10 ykforerlang

好的

gitspringcould avatar Oct 17 '19 03:10 gitspringcould