perf: remove chrome passive warning
parent
fa5a6d87ff
commit
e7e3aeb548
|
@ -15,7 +15,7 @@ const eventsName = `onCopy onCut onPaste onCompositionend onCompositionstart onC
|
||||||
onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick
|
onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick
|
||||||
onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown
|
onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown
|
||||||
onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel
|
onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel
|
||||||
onTouchend onTouchmove onTouchstart onScroll onWheel onAbort onCanplay onCanplaythrough
|
onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough
|
||||||
onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata
|
onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata
|
||||||
onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError`;
|
onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError`;
|
||||||
|
|
||||||
|
|
|
@ -439,6 +439,15 @@ const Drawer = defineComponent({
|
||||||
onKeydown: open && keyboard ? this.onKeyDown : noop,
|
onKeydown: open && keyboard ? this.onKeyDown : noop,
|
||||||
style: { ...wrapStyle, ...style },
|
style: { ...wrapStyle, ...style },
|
||||||
};
|
};
|
||||||
|
// 跑用例用
|
||||||
|
const touchEvents = {
|
||||||
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: open
|
||||||
|
? this.removeStartHandler
|
||||||
|
: noop,
|
||||||
|
[supportsPassive ? 'onTouchmovePassive' : 'onTouchmove']: open
|
||||||
|
? this.removeMoveHandler
|
||||||
|
: noop,
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={c => {
|
ref={c => {
|
||||||
|
@ -475,8 +484,7 @@ const Drawer = defineComponent({
|
||||||
ref={c => {
|
ref={c => {
|
||||||
this.contentDom = c;
|
this.contentDom = c;
|
||||||
}}
|
}}
|
||||||
onTouchstart={open ? this.removeStartHandler : noop} // 跑用例用
|
{...touchEvents}
|
||||||
onTouchmove={open ? this.removeMoveHandler : noop} // 跑用例用
|
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import classNames from '../../_util/classNames';
|
||||||
import KeyCode from '../../_util/KeyCode';
|
import KeyCode from '../../_util/KeyCode';
|
||||||
import InputHandler from './InputHandler';
|
import InputHandler from './InputHandler';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
import supportsPassive from '../../_util/supportsPassive';
|
||||||
|
|
||||||
function preventDefault(e) {
|
function preventDefault(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -699,11 +700,13 @@ export default defineComponent({
|
||||||
let downEvents;
|
let downEvents;
|
||||||
if (useTouch) {
|
if (useTouch) {
|
||||||
upEvents = {
|
upEvents = {
|
||||||
onTouchstart: editable && !upDisabledClass && this.up,
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']:
|
||||||
|
editable && !upDisabledClass && this.up,
|
||||||
onTouchend: this.stop,
|
onTouchend: this.stop,
|
||||||
};
|
};
|
||||||
downEvents = {
|
downEvents = {
|
||||||
onTouchstart: editable && !downDisabledClass && this.down,
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']:
|
||||||
|
editable && !downDisabledClass && this.down,
|
||||||
onTouchend: this.stop,
|
onTouchend: this.stop,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import warning from '../../_util/warning';
|
||||||
import BaseMixin from '../../_util/BaseMixin';
|
import BaseMixin from '../../_util/BaseMixin';
|
||||||
import { ITouchProps } from './PropTypes';
|
import { ITouchProps } from './PropTypes';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
import supportsPassive from '../../_util/supportsPassive';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'TouchFeedback',
|
name: 'TouchFeedback',
|
||||||
|
@ -76,8 +77,8 @@ export default defineComponent({
|
||||||
const events = disabled
|
const events = disabled
|
||||||
? undefined
|
? undefined
|
||||||
: {
|
: {
|
||||||
onTouchstart: this.onTouchStart,
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: this.onTouchStart,
|
||||||
onTouchmove: this.onTouchMove,
|
[supportsPassive ? 'onTouchmovePassive' : 'onTouchmove']: this.onTouchMove,
|
||||||
onTouchend: this.onTouchEnd,
|
onTouchend: this.onTouchEnd,
|
||||||
onTouchcancel: this.onTouchCancel,
|
onTouchcancel: this.onTouchCancel,
|
||||||
onMousedown: this.onMouseDown,
|
onMousedown: this.onMouseDown,
|
||||||
|
|
|
@ -23,6 +23,7 @@ import {
|
||||||
import Track from './track';
|
import Track from './track';
|
||||||
import Dots from './dots';
|
import Dots from './dots';
|
||||||
import { PrevArrow, NextArrow } from './arrows';
|
import { PrevArrow, NextArrow } from './arrows';
|
||||||
|
import supportsPassive from '../../_util/supportsPassive';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
|
@ -694,8 +695,11 @@ export default {
|
||||||
onMousemove: this.dragging && touchMove ? this.swipeMove : noop,
|
onMousemove: this.dragging && touchMove ? this.swipeMove : noop,
|
||||||
onMouseup: touchMove ? this.swipeEnd : noop,
|
onMouseup: touchMove ? this.swipeEnd : noop,
|
||||||
onMouseleave: this.dragging && touchMove ? this.swipeEnd : noop,
|
onMouseleave: this.dragging && touchMove ? this.swipeEnd : noop,
|
||||||
onTouchstart: touchMove ? this.swipeStart : noop,
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: touchMove
|
||||||
onTouchmove: this.dragging && touchMove ? this.swipeMove : noop,
|
? this.swipeStart
|
||||||
|
: noop,
|
||||||
|
[supportsPassive ? 'onTouchmovePassive' : 'onTouchmove']:
|
||||||
|
this.dragging && touchMove ? this.swipeMove : noop,
|
||||||
onTouchend: touchMove ? this.swipeEnd : noop,
|
onTouchend: touchMove ? this.swipeEnd : noop,
|
||||||
onTouchcancel: this.dragging && touchMove ? this.swipeEnd : noop,
|
onTouchcancel: this.dragging && touchMove ? this.swipeEnd : noop,
|
||||||
onKeydown: this.accessibility ? this.keyHandler : noop,
|
onKeydown: this.accessibility ? this.keyHandler : noop,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import supportsPassive from '../../../_util/supportsPassive';
|
||||||
import classNames from '../../../_util/classNames';
|
import classNames from '../../../_util/classNames';
|
||||||
import { isValidElement } from '../../../_util/props-util';
|
import { isValidElement } from '../../../_util/props-util';
|
||||||
|
|
||||||
|
@ -51,13 +52,16 @@ const Marks = (_, { attrs }) => {
|
||||||
|
|
||||||
const style = vertical ? bottomStyle : leftStyle;
|
const style = vertical ? bottomStyle : leftStyle;
|
||||||
const markStyle = markPointIsObject ? { ...style, ...markPoint.style } : style;
|
const markStyle = markPointIsObject ? { ...style, ...markPoint.style } : style;
|
||||||
|
const touchEvents = {
|
||||||
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: e => onClickLabel(e, point),
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
class={markClassName}
|
class={markClassName}
|
||||||
style={markStyle}
|
style={markStyle}
|
||||||
key={point}
|
key={point}
|
||||||
onMousedown={e => onClickLabel(e, point)}
|
onMousedown={e => onClickLabel(e, point)}
|
||||||
onTouchstart={e => onClickLabel(e, point)}
|
{...touchEvents}
|
||||||
>
|
>
|
||||||
{markLabel}
|
{markLabel}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Marks from './Marks';
|
||||||
import Handle from '../Handle';
|
import Handle from '../Handle';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
import BaseMixin from '../../../_util/BaseMixin';
|
import BaseMixin from '../../../_util/BaseMixin';
|
||||||
|
import supportsPassive from '../../../_util/supportsPassive';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
|
@ -295,13 +296,18 @@ export default function createSlider(Component) {
|
||||||
class: `${prefixCls}-mark`,
|
class: `${prefixCls}-mark`,
|
||||||
onClickLabel: disabled ? noop : this.onClickMarkLabel,
|
onClickLabel: disabled ? noop : this.onClickMarkLabel,
|
||||||
};
|
};
|
||||||
|
const touchEvents = {
|
||||||
|
[supportsPassive ? 'onTouchstartPassive' : 'onTouchstart']: disabled
|
||||||
|
? noop
|
||||||
|
: this.onTouchStart,
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
id={id}
|
id={id}
|
||||||
ref={this.saveSlider}
|
ref={this.saveSlider}
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
class={sliderClassName}
|
class={sliderClassName}
|
||||||
onTouchstart={disabled ? noop : this.onTouchStart}
|
{...touchEvents}
|
||||||
onMousedown={disabled ? noop : this.onMouseDown}
|
onMousedown={disabled ? noop : this.onMouseDown}
|
||||||
onMouseup={disabled ? noop : this.onMouseUp}
|
onMouseup={disabled ? noop : this.onMouseUp}
|
||||||
onKeydown={disabled ? noop : this.onKeyDown}
|
onKeydown={disabled ? noop : this.onKeyDown}
|
||||||
|
|
Loading…
Reference in New Issue