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

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

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

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

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

猜你喜欢

转载自blog.csdn.net/saygood999/article/details/106518149