query传参 和 params传参方式

1,295 阅读1分钟
 1.路由传参:query
	data:{
		name:'',
		obj:{
	   	    a:1,
	   	    b:2
		}
	}
 	<router-link :to="{path:'/home',query:obj}"></router-link>
	
       const route={
	path:'/home',
	name:'home',
	component:home
	
	}
	
	2.路径传参:params
 	//第一种:
 	<router-link to="/home/123/234"></router-link>
	//路径传参 只能写name 不能写path
	//第二种:
	<router-link :to="{name:'home',params:{qqq:123,aaa:234}}">
		   </router-link>

       const route={
	path:'/home/:qqq/:aaa',
	name:'home',
	component:home
	
	}