赞
踩
getColumnOffset(columnProp) { this.$nextTick(() => { const table = this.$refs.tableRef.$refs.multipleTable; const columns = table.columns; const column = columns.find((col) => col.property === columnProp); if (column) { // const cell = table.$el.querySelector(`th[data-property=${columnProp}]`); const cell = table.$el.querySelector(`.${column.id}`); if (cell) { const rect = cell.getBoundingClientRect(); const offset = rect.left - table.$el.getBoundingClientRect().left; console.log(`${columnProp}列距离左侧的位置是: ${offset}px`); this.$refs.tableRef.$refs.multipleTable.bodyWrapper.scrollLeft = `${offset}`; //Number(this.$refs.tableRef.$refs.multipleTable.bodyWidth.replace('px','')); } } }); },
this.getColumnOffset(“operName”);
会将滚动条滚动到设置的列,方便编辑;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。