我为所有路由使用基名:
`
const history = createHistory({ basename: basename });
`
但我不想在一个路由(/ callback)中使用basename:
`
<ConnectedRouter history={history}>
<Switch>
<Route path="/callback"/> //this one !
<Route path="/login" component={Login} />
<Route path="/" component={Home} />
</Switch>
</ConnectedRouter>
`
我怎样才能做到这一点 ?
谢谢你的时间和回答:D
你不能拥有它的方式。您需要一个单独的历史记录来处理:
<OtherRouter history={historyWithNoBasename}>
<Route path="/callback"/>
</OtherRouter>
<ConnectedRouter history={history}>
<Switch>
<Route path="/login" component={Login} />
<Route path="/" component={Home} />
</Switch>
</ConnectedRouter>