需求:把组件中的数据增加到路由路径中,在另外一个组件中读取到数据。
学生路由把数据增加到path中的classId
{
desc: "学生列表",
name: "studentList",
path: "studentList/:classesId",
component: manageStudent,
meta: {
requireAuth: true,
roleList: ["0", "1"]
}
},
因为这里是params传参,因此的使用命名路由,并且把数据增加到params
handleEdit(index, row) {
this.$router.push({
name: "studentList",
params: { classesId: row.classesId },
});
},
获取路由路径中path中classId中的数据
this.classesId = this.$route.params.classesId;