vue路由跳转方式及路由跳转传参和获取参数

1.路由跳转方式

// 1.声明式导航
	<router-link to='/list'></router-link>
// 2.编程式导航
	this.$router.push('/list')

2.路由跳转传参

// 1.路径传参, 在跳转路径中 :
 	/detail/:id
 	/detail/:100
 	在跳转后的页面获取参数
 	this.$route.params.id
// 2.查询传参,在跳转路径中 ?
	/detail?id=100
	在跳转后的页面获取参数
	this.$route.query.id
// 3.如果传多个参数,可以通过&号连接
	

猜你喜欢

转载自blog.csdn.net/m0_49159526/article/details/107753305