@@ -33,6 +33,7 @@ import useSticky from './hooks/useSticky';
33
33
import FixedHolder from './FixedHolder' ;
34
34
import type { CSSProperties } from 'vue' ;
35
35
import {
36
+ onUpdated ,
36
37
computed ,
37
38
defineComponent ,
38
39
nextTick ,
@@ -327,6 +328,10 @@ export default defineComponent<TableProps<DefaultRecordType>>({
327
328
const fullTableRef = ref < HTMLDivElement > ( ) ;
328
329
const scrollHeaderRef = ref < HTMLDivElement > ( ) ;
329
330
const scrollBodyRef = ref < HTMLDivElement > ( ) ;
331
+ const scrollBodySizeInfo = ref < { scrollWidth : number ; clientWidth : number } > ( {
332
+ scrollWidth : 0 ,
333
+ clientWidth : 0 ,
334
+ } ) ;
330
335
const scrollSummaryRef = ref < HTMLDivElement > ( ) ;
331
336
const [ pingedLeft , setPingedLeft ] = useState ( false ) ;
332
337
const [ pingedRight , setPingedRight ] = useState ( false ) ;
@@ -495,6 +500,18 @@ export default defineComponent<TableProps<DefaultRecordType>>({
495
500
nextTick ( ( ) => {
496
501
triggerOnScroll ( ) ;
497
502
setScrollbarSize ( getTargetScrollBarSize ( scrollBodyRef . value ) . width ) ;
503
+ scrollBodySizeInfo . value = {
504
+ scrollWidth : scrollBodyRef . value ?. scrollWidth || 0 ,
505
+ clientWidth : scrollBodyRef . value ?. clientWidth || 0 ,
506
+ } ;
507
+ } ) ;
508
+ } ) ;
509
+ onUpdated ( ( ) => {
510
+ nextTick ( ( ) => {
511
+ scrollBodySizeInfo . value = {
512
+ scrollWidth : scrollBodyRef . value ?. scrollWidth || 0 ,
513
+ clientWidth : scrollBodyRef . value ?. clientWidth || 0 ,
514
+ } ;
498
515
} ) ;
499
516
} ) ;
500
517
@@ -762,6 +779,7 @@ export default defineComponent<TableProps<DefaultRecordType>>({
762
779
scrollBodyRef = { scrollBodyRef }
763
780
onScroll = { onScroll }
764
781
container = { container }
782
+ scrollBodySizeInfo = { scrollBodySizeInfo . value }
765
783
/>
766
784
) }
767
785
</ >
0 commit comments