el-table 有滚动时表头表格错位

在这里插入图片描述

// 普通表格在加载数据以后加入下面代码
this.$nextTick(() => {
  // 重新布局解决表头表格窜行问题
  if (this.$refs.myTable && this.$refs.myTable.doLayout) {
    this.$refs.myTable.doLayout();
  }
})

// 树形结构表格,展开时出现滚动,收起时没有滚动则监听树形展开收起事件
expandChange(row){
  this.$nextTick(() => {
    // 重新布局解决表头表格窜行问题
    if (this.$refs.myTable && this.$refs.myTable.doLayout) {
      this.$refs.myTable.doLayout();
    }
  })
}

版权声明:本文为qq_42913476原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
THE END
< <上一篇
下一篇>>