一、query传参

1.在路由配置页设置

	path:"/test";

2.在跳转发起页设置

	this.$router.push ( { path : " / test ",query : {  id:111 } )

3.跳转之后地址栏中携带参数

	https://XXXX?id=111

4.接收参数

	this.$route.query.id

二、params传参

1.在路由配置页设置

	name:"test";

2.在跳转发起页设置

	this.$router.push ( { name : " / test ",params : {  id:111 } )

3.跳转之后地址栏中携带参数

	https://XXXX

4.接收参数

	this.$route.params.id

三、location预声明参数

1.在路由配置页设置

	path:"/test/:id";

2.在跳转发起页设置

	this.$router.push ( { path : " / test / 111 ")

3.跳转之后地址栏中携带参数

	https://XXXX?id=111

4.接收参数

	this.$route.params.id
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐