vue页面返回路由替换

193 阅读1分钟

真实情况是这样,比如我在播放详情页自动播放完毕后,跳转到下一个播放详情页。但是返回想返回到列表页,这个时候就用到了router的replace。

其实我们用的最多的是this.$router.push。 replace和push用法一样。穿参数也一样。

 this.$router.replace({
    name:'detail',
    params:{
        id:nextItem.aid
    }
});