路由页面目录:
pages
detail/
_id.vue
注意这里路由name的值是: detail-id
参数传递
<nuxt-link :to="{name: 'detail-id', params:{id: id}, query: {key, value}}"></nuxt-link>
或者
this.$router.push({ name: 'detail-id', params:{id: 10}, query: {key, value}})
接收参数
created () {
this.$route.query.key
this.$route.params.id
},
asyncData ({ app, query, params}) {
query.key
params.id
}
参考
nuxt路由及传参