fix(components): [table-v2] endReached triggered twice when first (#11928)

This commit is contained in:
井柏然 2023-03-10 14:49:20 +08:00 committed by GitHub
parent a99bc4fb49
commit 406ac68fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 15 deletions

View File

@ -1,11 +1,4 @@
import {
computed,
getCurrentInstance,
ref,
shallowRef,
unref,
watch,
} from 'vue'
import { computed, getCurrentInstance, ref, shallowRef, unref } from 'vue'
import { debounce } from 'lodash-unified'
import { isNumber } from '@element-plus/utils'
import { FixedDir } from '../constants'
@ -28,13 +21,11 @@ type UseRowProps = {
mainTableRef: GridInstanceRef
leftTableRef: GridInstanceRef
rightTableRef: GridInstanceRef
onMaybeEndReached: () => void
}
export const useRow = (
props: TableV2Props,
{ mainTableRef, leftTableRef, rightTableRef, onMaybeEndReached }: UseRowProps
{ mainTableRef, leftTableRef, rightTableRef }: UseRowProps
) => {
const vm = getCurrentInstance()!
const { emit } = vm
@ -148,8 +139,6 @@ export const useRow = (
flushingRowHeights()
}
}
// when rendered row changes, maybe reaching the bottom
watch(lastRenderedRowIndex, () => onMaybeEndReached())
return {
hoveringRowKey,

View File

@ -60,8 +60,6 @@ function useTable(props: TableV2Props) {
mainTableRef,
leftTableRef,
rightTableRef,
onMaybeEndReached,
})
const { data, depthMap } = useData(props, {