app.vue
<button @click="goBack">后退</button>
<button @click="go">前进</button>
<button @click="goHome">返回首页</button>
<script>
export default {
name: 'app',
methods:{
goBack(){
this.$router.go(-1);
},
go(){
this.$router.go(1);
},
goHome(){
this.$router.push('/');//可以跳转任意页面
}
}
}
</script>