来源:未知 时间:2019-04-10 16:51 作者:小飞侠 阅读:次
[导读] HashRouter react哈希路由 A Router that uses the hash portion of the URL (i.e. window.location.hash) to keep your UI in sync with the URL. 使用URL的哈希部分(即window.location.hash)保持用户界面与URL同步的router。 IM...
<HashRouter> react哈希路由A <Router> that uses the hash portion of the URL (i.e. window.location.hash) to keep your UI in sync with the URL. 使用URL的哈希部分(即window.location.hash)保持用户界面与URL同步的<router>。 IMPORTANT NOTE: Hash history does not support location.key or location.state. In previous versions we attempted to shim the behavior but there were edge-cases we couldn’t solve. Any code or plugin that needs this behavior won’t work. As this technique is only intended to support legacy browsers, we encourage you to configure your server to work with <BrowserHistory> instead. 重要提示:哈希历史不支持location.key或location.state。在以前的版本中,我们试图填充行为,但有一些边缘情况我们无法解决。任何需要此行为的代码或插件都无法工作。由于此技术仅用于支持传统浏览器,因此我们建议您将服务器配置为使用<browserhistory>。 import { HashRouter } from 'react-router-dom' <HashRouter> <App/> </HashRouter> basename: stringThe base URL for all locations. A properly formatted basename should have a leading slash, but no trailing slash. 所有位置的基本URL。格式正确的basename应该有一个前导斜杠,但不能有尾随斜杠。 <HashRouter basename="/calendar"/> <Link to="/today"/> // renders <a href="#/calendar/today"> getUserConfirmation: funcA function to use to confirm navigation. Defaults to using window.confirm. 用于确认导航的功能。默认为使用window.confirm。 // this is the default behavior function getConfirmation(message, callback) { const allowTransition = window.confirm(message); callback(allowTransition);} <HashRouter getUserConfirmation={getConfirmation} />; hashType: stringThe type of encoding to use for window.location.hash. Available values are: 用于window.location.hash的编码类型。可用值包括: "slash" - Creates hashes like #/ and #/sunshine/lollipops "noslash" - Creates hashes like # and #sunshine/lollipops "hashbang" - Creates “ajax crawlable” (deprecated by Google) hashes like #!/ and #!/sunshine/lollipops Defaults to "slash". children: nodeA single child element to render. 要呈现的单个子元素。 更多延伸~~ https://reacttraining.com/react-router/web/api/HashRouter |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com