yuwenjing0727
/**
* @description: 通过表格索引 定位表格的位置
* @param {refName} table的ref值
* @param {index} table的索引值
* @return:
* @author: ywj
*/
$tableScrollMove(refName,index=0){
if(!refName || !this.$refs[refName]) return//不存在表格的ref vm 则返回
let vmEl = this.$refs[refName].$el
if(!vmEl) return
//计算滚动条的位置
const targetTop = vmEl.querySelectorAll(\'.el-table__body tr\')[index].getBoundingClientRect().top
const containerTop = vmEl.querySelector(\'.el-table__body\').getBoundingClientRect().top
const scrollParent = vmEl.querySelector(\'.el-table__body-wrapper\')
scrollParent.scrollTop = targetTop - containerTop
},

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-15
  • 2021-07-12
  • 2021-12-26
  • 2021-12-26
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案