编程式导航

<template>
  <div id="app">
    <img src="./assets/logo.png">
    <br>
    
    <router-link to="/">首页</router-link>
    <router-link to="/params/2018-6-18/世界杯">params</router-link> |
    <router-link to="/goHome">go 首页</router-link>
    <router-link to="/goparams/2018-6-19/我们">GOparams</router-link> |
    <router-view/>
  <div>
      <button @click="goback">后退</button>
      <button @click="go">前进</button>
  </div>
  </div>

</template>

<script>
export default {
  name: 'App',
  methods:{
    goback(){
      this.$router.go(-1);
    },
    go(){
       this.$router.go(1);
    }
}
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

  

posted @ 2018-06-18 22:52  1点  阅读(277)  评论(0编辑  收藏  举报