Response-路由器URL在手動刷新或寫入時不起作用我使用的反應路由器,它的工作,我點擊鏈接按鈕,但當我刷新我的網(wǎng)頁,它不加載我想要的。例如,我在localhost/joblist一切都很好,因為我來到這里,按下了一個鏈接。但是如果我刷新網(wǎng)頁,我會得到:Cannot GET /joblist默認情況下,它不是這樣工作的。一開始我的URL是localhost/#/和localhost/#/joblist他們工作得很好。但我不喜歡這種URL,所以想抹去#,我寫道:Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(<Handler/>, document.body);});這個問題不會發(fā)生在localhost/這個總是回報我想要的。編輯:這個應用程序是單頁的,所以/joblist不需要問任何服務器。EDIT 2:我的整個路由器。var routes = (
<Route name="app" path="/" handler={App}>
<Route name="joblist" path="/joblist" handler={JobList}/>
<DefaultRoute handler={Dashboard}/>
<NotFoundRoute handler={NotFound}/>
</Route>);Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(<Handler/>, document.body);});
Response-路由器URL在手動刷新或寫入時不起作用
慕容3067478
2019-06-03 15:57:17