Skip to content
On this page

vue-router 路由传参、获取

query传参

vue
this.$router.push({ name: 'home', params: { type: 1 }})

params传参

vue
this.$router.push({ path: '/home', query: { type: 1 }})

如果使用query方式传入的参数使用this.$route.query 接收

如果使用params方式传入的参数使用this.$router.params接收

query刷新不会丢失query里面的数据, params刷新会丢失 params里面的数据

更新时间: