美文网首页
这边讲解一下this.$router.push和this.$ro

这边讲解一下this.$router.push和this.$ro

作者: jesse28 | 来源:发表于2023-01-16 13:56 被阅读0次

参考链接:https://blog.csdn.net/weixin_50723416/article/details/119531773
这边最主要的区别在与this.router.replace是替换当前页面,这样this.router.go(-1)就会有问题

1.跳转到指定的URL,替换history栈中最后一个记录,点击后退会返回至上一个页面。(A----->B----->C 结果B被C替换 A----->C)
2.设置置replace属性(默认值:false)的话,当点击时,会调用router.replace(),而不是router.push(),于是导航后不会留下history记录。即使点击返回按钮也不会回到这个页面。加上replace: true时,它不会向 history 添加新纪录,而是跟它的方法名一样——替换当前的history记录。

相关文章

网友评论

      本文标题:这边讲解一下this.$router.push和this.$ro

      本文链接:https://www.haomeiwen.com/subject/orpzcdtx.html