js
let table = document.getElementById('id名字');
table.scrollTop = table.scrollHeight;
ref="listTable" border :data="adContentData" row-key="id" class="mt20" height="400px" > ..... // 添加内容 add() { this.contentData.push({ adImg_big: '', jumpUrl: '', editType: true, sort: this.sort }) this.sort++ this.$nextTick(() => { this.$refs.listTable.bodyWrapper.scrollTop = this.$refs.listTable.bodyWrapper.scrollHeight; }) },
如果要在不同屏幕下表格高度需要适应屏幕的话,需要用到 window.onresize 函数
window.onresize = () => {
this.height= window.innerHeight - 405;
}