vue 返回上一个页面

一、this.$router.go(-1):原页面中的内容会丢失

  this.$router.go() 刷新

  this.$router.(-1) 后退+刷新

  this.$router(1) 前进

二、this.$router.back():原页面中的内容会保留

  this.$router.back() 后退

  this.$router.back(0) 刷新

  this.$router.back(1) 前进

三:window.history.go(-1): 返回浏览器的上一页,在hash模式下就不会跳回浏览器上一页

 

posted @ 2022-12-06 16:01  xiaoxiaoxigua  阅读(533)  评论(0编辑  收藏  举报