<Router>
使用URL(即window.location.hash
)的哈希部分来保持UI与URL同步的A。react
重要说明:哈希历史记录不支持location.key
或location.state
。在之前的版本中,咱们试图填充行为,可是有一些咱们没法解决的边缘状况。任何须要此行为的代码或插件都不起做用。因为此技术仅用于支持旧版浏览器,所以咱们建议您配置要使用的服务器<BrowserHistory>
。web
HashRouter
是经过 hash
值来对路由进行控制。使用 HashRouter
,路由会默认有个#。ajax
basename:同<BrowserRouter>相似api
getUserConfirmation:同<BrowserRouter>相似浏览器
hashType:string
要用于的编码类型window.location.hash。可用值包括:
"slash"- 建立像#/和的哈希#/sunshine/lollipops
"noslash"- 建立像#和的哈希#sunshine/lollipops
"hashbang"- 建立“ajax crawlable”(谷歌弃用)哈希像#!/和#!/sunshine/lollipops
默认为"slash"。服务器
children:同<BrowserRouter>相似react-router