【发布时间】:2025-11-24 14:20:05
【问题描述】:
我正在尝试使用 browserHistory 并向路径添加参数,但是在向路径添加参数时我无法找到页面,因为浏览器正在查看的路径不正确,因为它在前面添加了“AddAmendLeague”的网址。
(http://localhost:8080/Home) 路径应该是什么:
(http://localhost:8080/AddAmendLeague/1) 现在浏览器找不到我的client.js:
ReactDOM.render(<Router history={browserHistory }>
<Route path='*' component={Layout}>
<IndexRoute component={Home}/>
<Route path="LeagueList" component={LeagueList}/>
<Route path="/AddAmendLeague/:LeagueID" component={AddAmendLeague}/>
</Route>
</Router>, app);
index.html
<script src="client.min.js"></script>
关于我做错了什么有什么想法吗?对不起,如果这是一个愚蠢的错误。
不太确定你是否需要我的 package.JSON
包.JSON
{
"name": "bableandtypescript",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --content-base src --inline --hot --watch --history-api-fallback"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.16.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"debug": "^2.3.2",
"es6-promise": "^4.0.5",
"flux": "^3.0.0",
"history": "^4.3.0",
"json-loader": "^0.5.4",
"mysql": "^2.12.0",
"net": "^1.0.2",
"radium": "^0.18.1",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-router": "^2.8.1",
"undebug": "^1.0.0",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.2",
"websocket": "^1.0.23"
}
}
【问题讨论】:
标签: reactjs react-router browser-history