第一种:get方法
传递值
<router-link :to="{path:'/test',query: {name: id}}">跳转</router-link>
接收值
this.$route.query.name
第二种:post方法
传递值
<router-link :to="{path:'/test',push: {name: id}}">跳转</router-link>
接收值
this.$route.params.name (在页面刷新的时候就会消失)
3
第三种:路由方法
传递值
//?问号的意思是该参数不是必传项//多个参数用/:id连接//path: '/Driver/CarManager/CarSettinghttp://zzdxjyzd.com/:car_id/:page_type',{ path: 'test/:name?', name: 'test', component: 'test.vue', props: true, },
接收值
props:{name:{required:false,default:''}} (页面刷新不消失,可以在路由配置中设置参数)
-----------------------------------分割线--------------------------------------------
另外: 如果在链接上设置 replace 属性,当点击时,会调用
作者:马小帅mm链接:https://www.jianshu.com/p/2be6f131cec5来源:简书简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
来源:https://www.cnblogs.com/dakunqq/p/11313858.html