1、router
Object used to send parameters on the page before jumping
//方法一:
//name:路由名称 params:要传递的参数
//这种方法不会在url中暴露参数
this.$router.push({
name:"index",
params:{
id:this.id,
}
});
//方法二:
//path:路由的路径 query:要传递的参数
//这种方法不会在url中暴露参数
this.$router.push({
path:"/index",
query:{
id:this.id,
}
});
2、route
Used to receive parameters on the page that receives data
//接收方法一的参数
let id = this.route.params.id;
//接收方法二的参数
let id = this.route.query.id;