vue使用路由跳转到上一页

this.$router.go(-1)

<template>
<div>
    <button class="btn btn-success" @click="goback()">返回上一页</button>
</div>
</template>
<script>
export default {
  name: "GoBack",
  data () {
    return {
    };
  },
  methods:{
      goback(){
          this.$router.go(-1)
      }
  }
}
</script>
<style lang="css" scoped>
</style>

猜你喜欢

转载自www.cnblogs.com/luguankun/p/10662278.html