2021-12-10 el-table 行内新增,滚动条自动滚到最顶部,或者最底部

1、el-table 组件 需要设置ref=""

 

2、关键代码:

  let item = {
        name: undefined,
        width: undefined,
        isShow: undefined,
        isSelect: undefined,
        code: undefined,
        dataSource: undefined,
        sortCode: undefined,
        type: undefined
   }
  this.dataForm.typeEntityList.push(item)
  // 跳到底部操作
   this.$nextTick(() => {
        this.$refs.containerTable.bodyWrapper.scrollTop = this.$refs.containerTable.bodyWrapper.scrollHeight
   });
  //跳到顶部操作
   this.$refs.containerTable.bodyWrapper.scrollTop =0 //可根据页面高度设置

3、效果图如下:


a1.png

你可能感兴趣的:(2021-12-10 el-table 行内新增,滚动条自动滚到最顶部,或者最底部)