history
约 1 分钟阅读
- remix-run/historyGitHubremix-run/historyremix-run/history · 实现 router 的基础 · 对应 window.history · api-reference · createPath,parsePath - url - location · createBrowserHistory, createHashHistory, createMemoryHistory笔记:history
- 实现 router 的基础
- 对应 window.history链接developer.mozilla.org/en-US/docs/Web/API/Historyremix-run/history · 实现 router 的基础 · 对应 window.history · api-reference · createPath,parsePath - url - location · createBrowserHistory, createHashHistory, createMemoryHistory笔记:history
- api-referenceGitHub 文件remix-run/history/docs/api-reference.md
- createPath,parsePath - url <-> location
- createBrowserHistory, createHashHistory, createMemoryHistory
- 三种不同的状态管理方式
- history
- createHref - browser 会考虑
<base/> - back,go
- forward -
go(1) - location - 当前 location
listen(({ action, location })=>{})- push, replace
- block
- createHref - browser 会考虑
- location - pathname,search,hash,state,key
- key - 唯一标识符,自动生成
- 配合 URLPattern链接developer.mozilla.org/en-US/docs/Web/API/URLPatternwicg urlpattern · 语法基于 path-to-regexp · - · , · - · - · - · , · - · - · - · - data url · - · Chrome 95+ · polyfill kenchris/urlpattern-polyfill笔记:URLPattern 可实现简单的路由功能
- Chrome 95+
关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub2 条
- remix-run/historygithub.com/remix-run/history
- remix-run/history/docs/api-reference.mdgithub.com/remix-run/history/blob/main/docs/api-reference.md
其他外链2 条
- developer.mozilla.org/en-US/docs/Web/API/Historydeveloper.mozilla.org/en-US/docs/Web/API/History
- developer.mozilla.org/en-US/docs/Web/API/URLPatterndeveloper.mozilla.org/en-US/docs/Web/API/URLPattern