mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
perf: add correct passive flag to improve scroll performance (#10951)
This commit is contained in:
parent
ca583e1075
commit
cb93bd2da3
@ -145,7 +145,10 @@ export default defineComponent({
|
||||
|
||||
linkChildren({ id, props, offset });
|
||||
useClickAway(root, onClickAway);
|
||||
useEventListener('scroll', onScroll, { target: scrollParent });
|
||||
useEventListener('scroll', onScroll, {
|
||||
target: scrollParent,
|
||||
passive: true,
|
||||
});
|
||||
|
||||
return () => (
|
||||
<div ref={root} class={bem()}>
|
||||
|
@ -182,7 +182,10 @@ export default defineComponent({
|
||||
nextTick(onScroll);
|
||||
};
|
||||
|
||||
useEventListener('scroll', onScroll, { target: scrollParent });
|
||||
useEventListener('scroll', onScroll, {
|
||||
target: scrollParent,
|
||||
passive: true,
|
||||
});
|
||||
|
||||
onMounted(init);
|
||||
|
||||
|
@ -166,7 +166,10 @@ export default defineComponent({
|
||||
|
||||
useExpose<ListExpose>({ check });
|
||||
|
||||
useEventListener('scroll', check, { target: scrollParent });
|
||||
useEventListener('scroll', check, {
|
||||
target: scrollParent,
|
||||
passive: true,
|
||||
});
|
||||
|
||||
return () => {
|
||||
const Content = slots.default?.();
|
||||
|
@ -140,7 +140,10 @@ export default defineComponent({
|
||||
(value) => emit('change', value)
|
||||
);
|
||||
|
||||
useEventListener('scroll', onScroll, { target: scrollParent });
|
||||
useEventListener('scroll', onScroll, {
|
||||
target: scrollParent,
|
||||
passive: true,
|
||||
});
|
||||
useVisibilityChange(root, onScroll);
|
||||
|
||||
return () => (
|
||||
|
@ -485,7 +485,10 @@ export default defineComponent({
|
||||
onActivated(setLine);
|
||||
onPopupReopen(setLine);
|
||||
onMountedOrActivated(init);
|
||||
useEventListener('scroll', onScroll, { target: scroller });
|
||||
useEventListener('scroll', onScroll, {
|
||||
target: scroller,
|
||||
passive: true,
|
||||
});
|
||||
|
||||
linkChildren({
|
||||
id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user