1.路徑:http://localhost:8081/#/test?name=1
<router-link :to="{path:'/test',query: {name: id}}">跳轉(zhuǎn)</router-link>(id是參數(shù))
使用:this.$route.query.id
2.路徑:http://localhost:8081/#/test/1
<router-link :to="'/test/'+id">跳轉(zhuǎn)</router-link>(id是參數(shù))
QQ截圖20170801203900.png
使用:this.$route.params.id(這個id給上圖路由的配置有關(guān))
this.$route是一個數(shù)組宫盔,里面包含路由的所有信息
注意:router-link中鏈接如果是‘/’開始就是從根路由開始,如果開始不帶‘/’验辞,則從當(dāng)前路由開始