有query传参和params传参 query:通过路由传参进行拼接,如下:
<router-link :to="{name:'login',query:{id:10110,username:'yansunda'}}">登录组件</router-link>
采用编程式导航使用query,使用$router.push
this.$router.push({ path:'/login', query:{ id:1909, name:'jdef', pwd:'123' } })
使用params的传参
<router-link :to="{name:'register',params:{id:'地球',username:'yansunda'}}">注册组件-配置对象-path</router-link> <router-link :to="{name:'register',params:{id:'月',username:'你好'}}">注册组件配置对象-name</router-link>
this.$router.push({ name:'register', params:{ id:'天空有云吗', username:'小红', userpwd:'123' } })
标签:传参,Vue,name,params,router,push,query,路由 From: https://www.cnblogs.com/yansunda/p/18384625