VUE,页面跳转传多个参数

<template>
  <a @click="goNext">Next</a>
  <input type="text" v-model="year"/>
  <input type="text" v-model="day"/>
</template>

<script>
  export default {
    data() {
      rerurn {year: '', day: ''}
    },
    methods: {
      goNext() {
        this.$router.push({name: 'test', params: {year: this.year, day: this.day}})
      }
    }
  }
</script>

A页面传递

 

<template>
  <div>{{this.$route.params.year}}{{this.$route.params.day}}</div>
</template>

B页面接收

 

{
  path: '/test',
  name: 'test',
  component: Test
}

修改router的index.js

 

 

如果还看不明白,参考:https://www.cnblogs.com/WQLong/p/7804215.html、https://blog.csdn.net/qq_15646957/article/details/78070862

反正我是看了这才明白的。

posted @ 2018-04-17 14:55  嘆世殘者——華帥  阅读(1132)  评论(0编辑  收藏  举报