0
深層鏈接使用下面的路由配置 -添加使用反應路由器
<Router history={hashHistory}>
<Route name="Home" path="/" component={BaseLayout}>
<Route name="Gateways" path="/gateways" component={DashboardLayout}>
<Route name="Login" path="/login" component={Login}/>
<Route name=":id" path="/gateways/:id">
<IndexRoute name="Dashboard" component={ViewGateWay}/>
<Route name="Access Points" path="/accesspoints" component={AccessPoints}>
<Route name=":id" path="/:id" component={ViewAccessPoint}/>
</Route>
<Route name="Devices" path="/devices" component={Devices}>
<Route name=":id" path="/:id" component={ViewDevice}/>
</Route>
</Route>
<IndexRoute component={Gateways} />
</Route>
<IndexRedirect to="Login" />
</Route>
</Router>
在路徑使用name
的麪包屑。有一個鏈接到/gateways/:id
,/gateways/:id/devices
,/gateways/:id/accesspoints
的側面菜單,最後兩個鏈接到單個設備和接入點,使用Link
作爲/gateways/:id/devices/:id
和/gateways/:id/accesspoints/:id
。當我給在側菜單中的鏈接作爲
<Link to="/gateways/${this.props.params.id}/accesspoints">Access Points</Link>
OR
<Link to="/accesspoints">Access Points</Link>
,我沒有得到正確的頁面。設備鏈接也一樣。我正在嘗試與麪包屑一起實現下面的API。
home/gateways/GW_ID1/dashboard
home/gateways/GW_ID1/accesspoints
home/gateways/GW_ID1/accesspoints/GW_AP1
home/gateways/GW_ID1/devices
home/gateways/GW_ID1/devices/GW_DV1
什麼是鏈接的正確方法?不使用任何處理程序。