Skip to content

Commit

Permalink
fix(comp:table): onScroll not work (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Jan 18, 2023
1 parent 3e69791 commit 79136b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/components/table/src/composables/useScroll.ts
Expand Up @@ -9,7 +9,7 @@ import { type ComputedRef, type Ref, computed, onBeforeUnmount, onMounted, ref,

import { useResizeObserver } from '@idux/cdk/resize'
import { type VirtualScrollInstance, type VirtualScrollToFn, getScrollBarSize, scrollToTop } from '@idux/cdk/scroll'
import { Logger, convertCssPixel, convertElement } from '@idux/cdk/utils'
import { Logger, callEmit, convertCssPixel, convertElement } from '@idux/cdk/utils'

import { type StickyContext } from './useSticky'
import { type TableProps } from '../types'
Expand All @@ -33,6 +33,7 @@ export function useScroll(
})

const { handleScroll, pingedStart, pingedEnd } = useScrollRef(
props,
scrollHeadRef,
scrollBodyRef,
scrollFootRef,
Expand Down Expand Up @@ -104,6 +105,7 @@ export interface ScrollOptions {
}

function useScrollRef(
props: TableProps,
scrollHeadRef: Ref<HTMLDivElement | undefined>,
scrollBodyRef: Ref<HTMLDivElement | undefined>,
scrollFootRef: Ref<HTMLDivElement | undefined>,
Expand Down Expand Up @@ -171,6 +173,10 @@ function useScrollRef(
pingedStart.value = mergedScrollLeft > 0
pingedEnd.value = mergedScrollLeft < scrollWidth - clientWidth
}

if (evt?.type === 'scroll') {
callEmit(props.onScroll, evt)
}
}

return { handleScroll, pingedStart, pingedEnd }
Expand Down

0 comments on commit 79136b5

Please sign in to comment.