vue 路由配置 和 react 路由配置

vue的路由配置:router-link   router-view   this.$router.push   this.$router.params.query

vue的路由守卫:全局路由守卫  beforeEach(to,from,next)    局部的路由守卫: beforeEnter(to,from,next)

vue的路由鉴权:meta{isAutch:true:false}

token   模拟  localStorage

react的路由配置 NavLink  Route Switch  Redirect withRouter HasnRouter BorwerRouter  Link  exact

路由参数:this.props.match,params.参数    this.props.history.push()

路由守卫:render={()=>{reten <路由/>}}  简单守卫

本篇文章持续更新详细内容

react简单路由守卫 

<Router>
    <Switch>
        <Route path='/mypage' render={()=>{
           retrun localStorage.getItem('username') ? <A /> : <Redirect to="login/">}}>
        <Route path='/login' component={Login}></Route>
    </Switch>
</Router>
原文地址:https://www.cnblogs.com/lrqcx/p/12145754.html