fix: passive warning #3392

pull/3433/head
tanjinzhou 2020-12-18 18:54:18 +08:00
parent 5913cf9c5c
commit 4f9555c64a
5 changed files with 14 additions and 14 deletions

View File

@ -166,7 +166,7 @@ export default defineComponent({
currentDocument,
'touchstart',
this.onDocumentClick,
supportsPassive ? { passive: true } : false,
supportsPassive ? { passive: false } : false,
);
}
// close popup when trigger type contains 'onContextmenu' and document is scrolling.

View File

@ -8,7 +8,7 @@ export default function addEventListenerWrap(target, eventType, cb, option) {
supportsPassive &&
(eventType === 'touchstart' || eventType === 'touchmove' || eventType === 'wheel')
) {
opt = { passive: true };
opt = { passive: false };
}
target.addEventListener(eventType, cb, opt);
}

View File

@ -268,7 +268,7 @@ const List = defineComponent({
componentRef.value.removeEventListener(
'wheel',
onRawWheel,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
componentRef.value.removeEventListener('DOMMouseScroll', onFireFoxScroll as any);
componentRef.value.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);
@ -281,7 +281,7 @@ const List = defineComponent({
componentRef.value.addEventListener(
'wheel',
onRawWheel,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
componentRef.value.addEventListener('DOMMouseScroll', onFireFoxScroll as any);
componentRef.value.addEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);

View File

@ -64,12 +64,12 @@ export default defineComponent({
this.scrollbarRef.current.addEventListener(
'touchstart',
this.onScrollbarTouchStart,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
this.thumbRef.current.addEventListener(
'touchstart',
this.onMouseDown,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
},
@ -104,7 +104,7 @@ export default defineComponent({
this.thumbRef.current.addEventListener(
'touchmove',
this.onMouseMove,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
this.thumbRef.current.addEventListener('touchend', this.onMouseUp);
},
@ -116,17 +116,17 @@ export default defineComponent({
this.scrollbarRef.current.removeEventListener(
'touchstart',
this.onScrollbarTouchStart,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
this.thumbRef.current.removeEventListener(
'touchstart',
this.onMouseDown,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
this.thumbRef.current.removeEventListener(
'touchmove',
this.onMouseMove,
supportsPassive ? ({ passive: true } as EventListenerOptions) : false,
supportsPassive ? ({ passive: false } as EventListenerOptions) : false,
);
this.thumbRef.current.removeEventListener('touchend', this.onMouseUp);

View File

@ -23,7 +23,7 @@ export default function useMobileTouchMove(
onTouchMove,
supportsPassive
? ({
passive: true,
passive: false,
} as EventListenerOptions)
: false,
);
@ -72,7 +72,7 @@ export default function useMobileTouchMove(
onTouchMove,
supportsPassive
? ({
passive: true,
passive: false,
} as EventListenerOptions)
: false,
);
@ -86,7 +86,7 @@ export default function useMobileTouchMove(
onTouchStart,
supportsPassive
? ({
passive: true,
passive: false,
} as EventListenerOptions)
: false,
);
@ -98,7 +98,7 @@ export default function useMobileTouchMove(
onTouchStart,
supportsPassive
? ({
passive: true,
passive: false,
} as EventListenerOptions)
: false,
);