企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
[toc] ## 历史记录栈 ![](https://box.kancloud.cn/2f55b6f21886dcebba93f17b9d0bae7b_149x283.png) ## 浏览器的前进后退 ![](https://box.kancloud.cn/f62ebc4550c49cf072baf18cea254e1c_190x28.png) ## Vue中的编程式导航 - `this.$router..back();` 后退一步 - `this.$router.forward()` 前进一步 - `this.$router.go()` this.$router.go(-1)后退一步 this.$router.go(2)前进两步 但当步数大于历史记录数,就会无效,嗯,是无效,而不是取一个最大值 this.$router.go(0) 会刷新页面 - `this.$router.push()` 和上面的主要区别在于会**添加**一条历史记录 this.$router.push('/home') this.$router.push({name:'home'}) 对象写法等同于router-link里的to - `this.$router.replace()` 会**替换**一条历史记录 ![](https://box.kancloud.cn/f70536b83b41e46e2d00f7b5aac45888_322x227.png)