ant固定列可编辑表格高度更改样式问题

阅读 32

2022-04-19

记录


      // 获取左中右的元素
      const scrollDiv = document.querySelector(`#tableId .ant-table-scroll > .ant-table-body`);
      const leftFixedDiv = document.querySelector(`#tableId .ant-table-fixed-left .ant-table-body-inner`);
      const rightFixedDiv = document.querySelector(`#tableId .ant-table-fixed-right .ant-table-body-inner`);

      // 获取左中右下的tr元素
      const cssSelector = `table.ant-table-fixed tr[data-row-key='${rowKey}']`;
      const leftFixedTr = leftFixedDiv.querySelector(cssSelector);
      const scrollTr = scrollDiv.querySelector(cssSelector);
      const rightFixedTr = rightFixedDiv.querySelector(cssSelector);

      // 获取滚动区域元素高度
      const theoryTrHeight = getComputedStyle(scrollTr).height;

      leftFixedTr.style.height = theoryTrHeight;
      rightFixedTr.style.height = theoryTrHeight;

精彩评论(0)

0 0 举报