mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(PullRefresh): remove passive event warning (#10938)
This commit is contained in:
parent
da3ad139d4
commit
1945c35b17
@ -17,7 +17,7 @@ import {
|
|||||||
} from '../utils';
|
} from '../utils';
|
||||||
|
|
||||||
// Composables
|
// Composables
|
||||||
import { useScrollParent } from '@vant/use';
|
import { useEventListener, useScrollParent } from '@vant/use';
|
||||||
import { useTouch } from '../composables/use-touch';
|
import { useTouch } from '../composables/use-touch';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@ -61,6 +61,7 @@ export default defineComponent({
|
|||||||
let reachTop: boolean;
|
let reachTop: boolean;
|
||||||
|
|
||||||
const root = ref<HTMLElement>();
|
const root = ref<HTMLElement>();
|
||||||
|
const track = ref<HTMLElement>();
|
||||||
const scrollParent = useScrollParent(root);
|
const scrollParent = useScrollParent(root);
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
@ -220,6 +221,15 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// add passive option to avoid Chrome warning
|
||||||
|
useEventListener('touchstart', onTouchStart as EventListener, {
|
||||||
|
target: track,
|
||||||
|
passive: true,
|
||||||
|
});
|
||||||
|
useEventListener('touchmove', onTouchMove as EventListener, {
|
||||||
|
target: track,
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const trackStyle = {
|
const trackStyle = {
|
||||||
transitionDuration: `${state.duration}ms`,
|
transitionDuration: `${state.duration}ms`,
|
||||||
@ -231,10 +241,9 @@ export default defineComponent({
|
|||||||
return (
|
return (
|
||||||
<div ref={root} class={bem()}>
|
<div ref={root} class={bem()}>
|
||||||
<div
|
<div
|
||||||
|
ref={track}
|
||||||
class={bem('track')}
|
class={bem('track')}
|
||||||
style={trackStyle}
|
style={trackStyle}
|
||||||
onTouchstart={onTouchStart}
|
|
||||||
onTouchmove={onTouchMove}
|
|
||||||
onTouchend={onTouchEnd}
|
onTouchend={onTouchEnd}
|
||||||
onTouchcancel={onTouchEnd}
|
onTouchcancel={onTouchEnd}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user