具体方法如下:
1.通过query获取路由参数
#配置路由<router-link :to="{ name:'login',query:{id:1} }">登录</router-link>#获取路由参数this.$route.query
<router-link :to="{ name:'login',query:{id:1} }">登录</router-link>
#获取路由参数
this.$route.query
2.通过params获取路由参数
#配置路由<router-link :to="{ name:'register',params:{'name':'San'} }">注册</router-link>#获取路由参数this.$route.params
<router-link :to="{ name:'register',params:{'name':'San'} }">注册</router-link>
this.$route.params