el-table新增一条行内数据
<el-table border ref="tableData" :data="tableData" style="width: 100%;" :height="pageHeight - 360"></el-table>
<el-button type="text" @click="addBtn">新增</el-button>
##(一定要在table里面加 ref=“xxxxxxxx”)
addBtn() {
let rowObj = {
id: null,
topDepth: '',
bottomDepth: '',
thickness: '',
interpConclusionName: '',
remark: '',
}
this.tableData.push(rowObj)
// 跳到最底部进行操作
this.$nextTick(() => {
this.$refs.tableData.bodyWrapper.scrollTop = this.$refs.tableData.bodyWrapper.scrollHeight
})
// 跳到顶部进行操作
this.$refs.tableData.bodyWrapper.scrollTop =0;
}