彻底搞懂路由跳转:location 和 history 接口

2018-04-01
阅读 3 分钟
32.4k
在单页应用中,通常由前端来配置路由,根据不同的 url 显示不同的内容。想要知道这是如何做到的,首先得了解浏览器提供的两大 API: window.location location.href location.hash location.search location.pathname window.history history.pushState() history.replaceState() history.go() history.back() history.f...