1.url的hash
location.hash="名称"
执行:
路由变成:
2.HTML5的history
history.pushState()
三个参数:data,title, url
执行:
路由变成:
history.replaceState()
执行:
路由变成:
pushState和replaceState的区别:
pushState()执行的操作类似于压栈,之前执行过的会保存。
replaceState()执行的操作替换,直接替换了上一个路由。