React-Router基础(<HashRouter>)
<Router>
使用URL(即window.location.hash
)的哈希部分来保持UI与URL同步的A。
重要说明:哈希历史记录不支持location.key
或location.state
。在以前的版本中,我们试图填充行为,但是有一些我们无法解决的边缘情况。任何需要此行为的代码或插件都不起作用。由于此技术仅用于支持旧版浏览器,因此我们建议您配置要使用的服务器<BrowserHistory>
。
HashRouter
是通过 hash
值来对路由进行控制。使用 HashRouter
,路由会默认有个#。
basename:同<BrowserRouter>类似
getUserConfirmation:同<BrowserRouter>类似
hashType:string
要用于的编码类型window.location.hash。可用值包括:
"slash"- 创建像#/和的哈希#/sunshine/lollipops
"noslash"- 创建像#和的哈希#sunshine/lollipops
"hashbang"- 创建“ajax crawlable”(谷歌弃用)哈希像#!/和#!/sunshine/lollipops
默认为"slash"。
children:同<BrowserRouter>类似
https://edu.51cto.com/lecturer/11857712.html 星星课堂web前端系列课程
https://edu.51cto.com/course/25959.html js设计模式课程
https://edu.51cto.com/course/23133.html js进阶与组件化实战课程
https://edu.51cto.com/course/24757.html jquery课程
https://edu.51cto.com/course/22392.html js基础与入门课程
https://edu.51cto.com/course/26063.html vue零基础入门课程
https://edu.51cto.com/course/22393.html xhtml与css基础入门课程