iview table表格自动定位到某一行且选中滚动到相应的位置

this.applyTable.tableData[1]._highlight = true//高亮某一行 util.isEmpty是一个工具类用来判断是否为空或者null的   此表格用的是iview ui 已.ivu开头的为iview表格,其它ui框架请自行更换即可
setTimeout(() => {
       util.isEmpty(document.querySelector('.testClass .ivu-table-tbody .ivu-table-row-highlight')) ? '': document.querySelector('.testClass .ivu-table-tbody .ivu-table-row-highlight').scrollIntoView({
                  behavior: "instant",
                  block: "start",
                  inline: "nearest"
                }
                )
            }, 100)
 

behavior:定义过渡动画。"auto","instant"或"smooth"。默认为"auto"。

block:"start","center","end"或"nearest"。默认为"center"

inline  "start","center","end"或"nearest"。默认为"nearest"
原文地址:https://www.cnblogs.com/yn-cn/p/12068489.html