vue中如何点击返回上一页,vue判断没有上页返回首页

vue中返回上一页
// 返回
returnBtn(){
  this.$router.go(-1);
},返回上一页,先判断是否有上一页,没有则返回指定页面
// 返回
returnBtn(){
  if (window.history.length <= 1) {
    this.$router.push({path:'/'});
    return false
  } else {
      this.$router.go(-1);
  }
},本文链接:https://my.lmcjl.com/post/20188.html
展开阅读全文
                                                
                    
4 评论