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"

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM