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, currentDocument,
'touchstart', 'touchstart',
this.onDocumentClick, this.onDocumentClick,
supportsPassive ? { passive: true } : false, supportsPassive ? { passive: false } : false,
); );
} }
// close popup when trigger type contains 'onContextmenu' and document is scrolling. // 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 && supportsPassive &&
(eventType === 'touchstart' || eventType === 'touchmove' || eventType === 'wheel') (eventType === 'touchstart' || eventType === 'touchmove' || eventType === 'wheel')
) { ) {
opt = { passive: true }; opt = { passive: false };
} }
target.addEventListener(eventType, cb, opt); target.addEventListener(eventType, cb, opt);
} }

View File

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

View File

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

View File

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