动态表格,可以新增行列数,为了用户体验,新增后超出表格流体高度后,自动滚动到最下方
需要element-plus如下api
代码如下:
const addCapacity = () => {
inputList.value.push({
name: "",
desc: "",
type: 2,
location: 2,
is_required: true,
global_default: "",
local_disable: true,
});
//滚动到最新的添加行
nextTick(() => {
if (inputTableRef.value) {
const $bodyWrapper =
inputTableRef.value.$el.querySelector(".el-table__body");
if ($bodyWrapper) {
inputTableRef.value.setScrollTop($bodyWrapper.scrollHeight);
}
}
});
};