💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
BrowserRouter跳转时的url是不带`#`的 ![](https://box.kancloud.cn/245c61f8c3555997fb3d3da989cc815b_770x462.png) 实现基础 pushState是异步的,so,如果你直接在下面go,此时还没有记录,也就不会触发popState ``` window.onpopstate = function(event) { console.log(history.state) }; // location.href = '#123' history.pushState({a:1},'1','?123') history.pushState({b:1},'2','?234') // history.go(-1); //这样是无效的 document.documentElement.onclick = function(e){ history.go(-1) } ``` >pupstate就会改变url,但不会立刻跳转,需要go()才会