mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
refactor(affix): throttle scroll
This commit is contained in:
parent
eeb48edca4
commit
1fb128b821
@ -8,7 +8,7 @@ import {
|
||||
PropType,
|
||||
h
|
||||
} from 'vue'
|
||||
import { getScrollParent, unwrapElement } from 'seemly'
|
||||
import { getScrollParent, unwrapElement, beforeNextFrameOnce } from 'seemly'
|
||||
import { useConfig, useStyle } from '../../_mixins'
|
||||
import { warn, keysOf } from '../../_utils'
|
||||
import type { ExtractPublicPropTypes } from '../../_utils'
|
||||
@ -108,7 +108,11 @@ export default defineComponent({
|
||||
handleScroll()
|
||||
}
|
||||
}
|
||||
const handleScroll = (): void => {
|
||||
function handleScroll (): void {
|
||||
beforeNextFrameOnce(_handleScroll)
|
||||
}
|
||||
|
||||
function _handleScroll (): void {
|
||||
const { value: containerEl } = scrollElementRef
|
||||
const { value: selfEl } = selfRef
|
||||
if (!containerEl || !selfEl) return
|
||||
|
Loading…
Reference in New Issue
Block a user