1.跳转页面
表格列
<el-table-column label="名称" align="center" >
<template slot-scope="scope">
<el-link type="primary" @click="handleDetail(scope.row)">{{scope.row.Name}} </el-link>
</template>
</el-table-column>
methods写方法
handleDetail(row){
//需要传的数据
const data = row.catalogueId;
//路由跳转到新页面
this.$router.push({ //核心语句
path:'attribute', //跳转的路径
query:{ //路由传参时push和query搭配使用 ,作用时传递参数
catalogueId:data,
}
})
},
2.新页面
接受数据
const data= this.$route.query.catalogueId;
这篇博客探讨了前端开发中如何实现表格列内的链接跳转,并详细讲解了在点击事件中如何通过`handleDetail`方法传递数据到新页面。在方法里,利用`$router.push`进行页面路由跳转,同时通过`query`参数传递`catalogueId`。在新页面,数据通过`this.$route.query`接收。这是一个关于前端路由管理和页面间数据通信的实际应用实例。

1万+

被折叠的 条评论
为什么被折叠?



