React-Router基础(<HashRouter>)

<Router>使用URL(即window.location.hash的哈希部分来保持UI与URL同步的A。

重要说明:哈希历史记录不支持location.keylocation.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>类似

猜你喜欢

转载自www.cnblogs.com/xingxingclassroom/p/10740184.html
今日推荐