1
我有以下途徑:React路由器路由通過?
<Router history={hashHistory}>
<Route path='/' component={ContainerApp}>
<Route component={ContainerAuth}>
<Route path="login" component={Login}/>
</Route>
<Route component={ContainerMain}>
<IndexRoute component={Home}/>
<Route path='settings' component={Settings}/>
<Route path='*' component={NotFound}/>
</Route>
</Route>
</Router>
const ContainerApp = (props) =>
<div>
{props.children}
</div>
const ContainerMain = (props) =>
<div className="mainwrapper">
<Header />
<div id="main">
<div id="wrapper" className="wrapper">
<DecoratedSidebar />
<section id="content">
{props.children}
</section>
</div>
</div>
<Footer />
</div>
const ContainerAuth = (props) =>
<div>
{props.children}
</div>
如果我輸入正確的網址「/登錄」到瀏覽器中其路由到該頁面。如果我推動使用:
this.props.router.push({
pathname: '/login'
});
它呈現ContainerAuth.Login,然後似乎通過並呈現ContainerMain.Home?
這是預期的行爲,即跌倒?
您是否在服務器上定義了「通配符」url?或如何處理路由? – wolendranh
編號唯一的'通配符'是: –
控制檯中是否有錯誤? – mik01aj