当前位置: 代码迷 >> 综合 >> vue中 this.$router.push和replace的区别
  详细解决方案

vue中 this.$router.push和replace的区别

热度:4   发布时间:2024-01-03 22:28:25.0

this.$router.push({path:'/pms/addProduct'});

实现指定url跳转,这个方法会向history栈添加一个记录,使用后退this.$router.back();会返回到上一个页面。

 

this.$router.replace({path:'/pms/addProduct'});

实现指定url跳转,这个方法不会向history栈添加记录,使用后退this.$router.back();会返回到上上一个页面。因为它的上个页面是不存在的。history栈没有记录

  相关解决方案