1、el-table 组件 需要设置ref=""
<el-table :data="dataForm.typeEntityList" size='mini' height="400" ref="containerTable"
v-loading="listLoading">
</el-table>
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