vue element table实现点击表格当前行跳转到页面对应id的方法
1.表格添加点击行的方法:(@row-click="overallClick")2.点击跳转的代码//点击当前行传入要跳转模块的idoverallClick(row){if(row){let id = row.Category;let that = this;that.showDetails(id)}},//获取...
·
1.表格添加点击行的方法:(@row-click="overallClick")
2.点击跳转的代码
//点击当前行传入要跳转模块的id
overallClick(row){
if(row){
let id = row.Category;
let that = this;
that.showDetails(id)
}
},
//获取id进行跳转
showDetails(id){
var el=document.getElementById(id);
this.$nextTick(function () {
window.scrollTo({"behavior":"smooth","top":el.offsetTop});
})
}
3.给对应模块添加id名
更多推荐
已为社区贡献3条内容
所有评论(0)