router-linkパラメータの使用


1.パス:http://localhost:8081/#/test?name=1
<router-link:to="{path:'/test',query:{name:id}}">  </router-link>
id   
thisを使用します。$route.query.id
2.パス:http://localhost:8081/#/test/1
<router-link :to="'/test/'+id">  </router-link> (id   )
ルート:
{
  path: '/test/:id',
  name: 'Test',
  component:require('./components/Test.vue')
}
使用:this.$route.params.id
this.$routeはルートのすべての情報を含む配列です。
注意:router-linkでリンクが「/」であればルートから開始し、最初に「/」を持たないと現在のルートから開始します。
ブログからの投稿:https://blog.csdn.net/sangjinchao/article/details/70888259