vue路由跳转 this.$router.go()

1.返回上一页

<button @click="goback">返回上页</button> methods:{
  goback(){ this.$router.go(-1)
  }
}

2.返回到指定页

<button @click="goToLink">返回page1</button> methods:{
  goToLink(){ this.$router.push(‘/page1‘)
}

或这样写

this.$router.push({name:‘page1‘})


文章来自:https://www.cnblogs.com/AliceLiu/p/12143469.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3