|
@@ -69,6 +69,7 @@ export function useTableScroll(
|
|
|
// )
|
|
// )
|
|
|
|
|
|
|
|
setTableHeight(dataSource?.length ? height : null)
|
|
setTableHeight(dataSource?.length ? height : null)
|
|
|
|
|
+
|
|
|
if (!dataSource?.length) {
|
|
if (!dataSource?.length) {
|
|
|
// TODO:针对无数据的情况下,特别设置tboody
|
|
// TODO:针对无数据的情况下,特别设置tboody
|
|
|
const tbodyEl: HTMLElement = tableElRef.current
|
|
const tbodyEl: HTMLElement = tableElRef.current
|
|
@@ -78,7 +79,12 @@ export function useTableScroll(
|
|
|
let hasScrollBar = el?.style.width !== '100%'
|
|
let hasScrollBar = el?.style.width !== '100%'
|
|
|
|
|
|
|
|
if (el?.style.width !== '100%') {
|
|
if (el?.style.width !== '100%') {
|
|
|
- hasScrollBar = el?.clientWidth > el?.style.width
|
|
|
|
|
|
|
+ const contentWidth =
|
|
|
|
|
+ tableElRef.current
|
|
|
|
|
+ ?.querySelector('.ant-table-container')
|
|
|
|
|
+ ?.querySelector('div.ant-table-content')?.clientWidth || 0
|
|
|
|
|
+
|
|
|
|
|
+ hasScrollBar = el?.clientWidth > contentWidth
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const notDataHeight = `${height - (hasScrollBar ? 8 : 0)}px`
|
|
const notDataHeight = `${height - (hasScrollBar ? 8 : 0)}px`
|