我有一条路径
<Route path="/account/:accountid/LoginPage"
component={LoginPage}/>
如果 url 是 -> ,这可以正常工作/account/12332/LoginPage
。我想要可选的查询参数。网址结构将是这样的
/account/12322/LoginPage?User=A&User=B
我已将路径修改为
<Route path="/account/:accountid/LoginPage(/:User)"
component={LoginPage}/>
在此之后,如果我尝试访问该 url,它不会将我重定向到相应的页面,而是会引发错误
useBasename.js:56 Uncaught TypeError: history.getCurrentLocation is not a function
at Object.getCurrentLocation (useBasename.js:56)
at Object.getCurrentLocation (useQueries.js:64)
at Object.listen (createTransitionManager.js:246)
at Object.componentWillMount (Router.js:97)
at ReactCompositeComponent.js:347
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:346)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:257)
at Object.mountComponent (ReactReconciler.js:45)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:370)