Open onlyJinx opened 5 months ago
应该是个 bug,可以设置下 scroll-x
应该是个 bug,可以设置下
scroll-x
scroll-x
这个也有想过,但是我们怎么获取调整后的列宽呢? 还有一种情况就是你前面那一列resize后后面的会出现被挤压变小, 这部分也要去计算出来, 所以我现在不知道如何通过获取这些数据然后动态赋值给scroll-x
应该是个 bug,可以设置下
scroll-x
scroll-x
这个也有想过,但是我们怎么获取调整后的列宽呢? 还有一种情况就是你前面那一列resize后后面的会出现被挤压变小, 这部分也要去计算出来, 所以我现在不知道如何通过获取这些数据然后动态赋值给scroll-x
要是拖拽后的总列宽超了 scroll-x,确实还是存在问题;
问题应该出在这,要是 xScrollable
能被覆盖直接设为 true 就可以解决了
不要设置max-height属性,原生js设置就好了 const setTableMaxHeight = () => { const rect = tableElement.value?.getBoundingClientRect(); domHeight.value = window.innerHeight - rect?.top - 50 //实现大量数据时,表格数据Y轴滚动 let tableBody = document.querySelector('.n-data-table-base-table-body') as HTMLElement//n-data-table-base-table-body if(tableBody) { tableBody.style.maxHeight = domHeight.value + 'px' } // 创建一个观察者对象 const observer = new MutationObserver(function(mutationsList, observer) { for(let mutation of mutationsList) { if (mutation.type === 'attributes' && mutation.attributeName === 'style') { const newHeight = tableBody.clientHeight; console.log('Height changed to:', newHeight); if(newHeight > domHeight.value) { tableBody.style.maxHeight = domHeight.value + 'px' } } } }); const config = { attributes: true }; observer.observe(tableBody, config); }
描述错误
在拖拽列宽的演示代码里添加max-height属性,就会出现拖拽列宽是没有滚动条出现导致后面的列无法显示
复现步骤
在列宽拖拽的代码里添加一个max-height属性就可以复现
最小复现链接
https://codesandbox.io/p/sandbox/still-currying-2mzd95
系统信息
使用的包管理器
npm
验证