<template>
  <h3>这事Test</h3>
  <button @click="goAboutParams">GotoAbout</button>
</template>

<script>
export default {
  name: "TestView",
  methods: {
    // 字符串路径
    goAbout: function () {
      this.$router.push('/about')
    },
    //对象形式的path
    goAboutPath: function () {
      this.$router.push({path: '/about'})
    },
    // 带params的push请求
    goAboutParams: function () {
      this.$router.push({
        name: 'about-params',
        params: {
          id: 1,
          name: 'roger'
        }
      })
    },
    // 带参数的router.push
    goAboutQuery: function () {
      this.$router.push({
        name: 'about',
        // query: {...this.$route.query}  // 映射query
        query: {id: 1}
      })
    }
  }
}
</script>


<style scoped>

</style>
