antd 表格Table滚顶到指定行
作者:
天使爱打盹 | 来源:发表于
2024-07-16 15:00 被阅读0次try {
// 表格滚顶到指定行
const tableEle = document.getElementById(details[0]?.patientNum)?.parentElement?.parentElement?.parentElement?.parentElement?.parentElement
const highlightRowEle = document.getElementById(details[0]?.patientNum)?.parentElement?.parentElement
if(tableEle && highlightRowEle) {
const tableEleTop = tableEle && tableEle.getBoundingClientRect().top
const tableEleClientHeight = tableEle && tableEle.getBoundingClientRect().height
const highlightRowEleTop = highlightRowEle && highlightRowEle.getBoundingClientRect().top
const scroll = highlightRowEleTop - tableEleTop - tableEleClientHeight / 2
tableEle.scrollBy({ top: scroll, behavior: 'smooth' })
}
} catch (e) {
console.log(e)
}
本文标题:antd 表格Table滚顶到指定行
本文链接:https://www.haomeiwen.com/subject/azukhjtx.html
网友评论