const scrollToRow = (rowIndex: number) => {
// 确保在 DOM 更新后调用滚动
nextTick(() => {
if (table.value) {
// @ts-ignore
const tableBody = table.value.$el.querySelector(".el-table__body-wrapper");
if (tableBody) {
const row = tableBody.querySelectorAll(".el-table__row")[rowIndex - 1]; // 由于索引从0开始,所以传入的行数需要减1
if (row) {
row.scrollIntoView({ behavior: "smooth" });
}
}
}
});
};
el-table 滚动到指定行
最新推荐文章于 2025-01-02 15:48:58 发布