File tree Expand file tree Collapse file tree 7 files changed +37
-11
lines changed Expand file tree Collapse file tree 7 files changed +37
-11
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const eventsName = `onCopy onCut onPaste onCompositionend onCompositionstart onC
15
15
onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick
16
16
onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown
17
17
onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel
18
- onTouchend onTouchmove onTouchstart onScroll onWheel onAbort onCanplay onCanplaythrough
18
+ onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough
19
19
onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata
20
20
onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError` ;
21
21
Original file line number Diff line number Diff line change @@ -439,6 +439,15 @@ const Drawer = defineComponent({
439
439
onKeydown : open && keyboard ? this . onKeyDown : noop ,
440
440
style : { ...wrapStyle , ...style } ,
441
441
} ;
442
+ // 跑用例用
443
+ const touchEvents = {
444
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] : open
445
+ ? this . removeStartHandler
446
+ : noop ,
447
+ [ supportsPassive ? 'onTouchmovePassive' : 'onTouchmove' ] : open
448
+ ? this . removeMoveHandler
449
+ : noop ,
450
+ } ;
442
451
return (
443
452
< div
444
453
ref = { c => {
@@ -475,8 +484,7 @@ const Drawer = defineComponent({
475
484
ref = { c => {
476
485
this . contentDom = c ;
477
486
} }
478
- onTouchstart = { open ? this . removeStartHandler : noop } // 跑用例用
479
- onTouchmove = { open ? this . removeMoveHandler : noop } // 跑用例用
487
+ { ...touchEvents }
480
488
>
481
489
{ children }
482
490
</ div >
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import classNames from '../../_util/classNames';
6
6
import KeyCode from '../../_util/KeyCode' ;
7
7
import InputHandler from './InputHandler' ;
8
8
import { defineComponent } from 'vue' ;
9
+ import supportsPassive from '../../_util/supportsPassive' ;
9
10
10
11
function preventDefault ( e ) {
11
12
e . preventDefault ( ) ;
@@ -699,11 +700,13 @@ export default defineComponent({
699
700
let downEvents ;
700
701
if ( useTouch ) {
701
702
upEvents = {
702
- onTouchstart : editable && ! upDisabledClass && this . up ,
703
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] :
704
+ editable && ! upDisabledClass && this . up ,
703
705
onTouchend : this . stop ,
704
706
} ;
705
707
downEvents = {
706
- onTouchstart : editable && ! downDisabledClass && this . down ,
708
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] :
709
+ editable && ! downDisabledClass && this . down ,
707
710
onTouchend : this . stop ,
708
711
} ;
709
712
} else {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import warning from '../../_util/warning';
5
5
import BaseMixin from '../../_util/BaseMixin' ;
6
6
import { ITouchProps } from './PropTypes' ;
7
7
import { defineComponent } from 'vue' ;
8
+ import supportsPassive from '../../_util/supportsPassive' ;
8
9
9
10
export default defineComponent ( {
10
11
name : 'TouchFeedback' ,
@@ -76,8 +77,8 @@ export default defineComponent({
76
77
const events = disabled
77
78
? undefined
78
79
: {
79
- onTouchstart : this . onTouchStart ,
80
- onTouchmove : this . onTouchMove ,
80
+ [ supportsPassive ? 'onTouchstartPassive' : ' onTouchstart' ] : this . onTouchStart ,
81
+ [ supportsPassive ? 'onTouchmovePassive' : ' onTouchmove' ] : this . onTouchMove ,
81
82
onTouchend : this . onTouchEnd ,
82
83
onTouchcancel : this . onTouchCancel ,
83
84
onMousedown : this . onMouseDown ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
23
23
import Track from './track' ;
24
24
import Dots from './dots' ;
25
25
import { PrevArrow , NextArrow } from './arrows' ;
26
+ import supportsPassive from '../../_util/supportsPassive' ;
26
27
27
28
function noop ( ) { }
28
29
@@ -694,8 +695,11 @@ export default {
694
695
onMousemove : this . dragging && touchMove ? this . swipeMove : noop ,
695
696
onMouseup : touchMove ? this . swipeEnd : noop ,
696
697
onMouseleave : this . dragging && touchMove ? this . swipeEnd : noop ,
697
- onTouchstart : touchMove ? this . swipeStart : noop ,
698
- onTouchmove : this . dragging && touchMove ? this . swipeMove : noop ,
698
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] : touchMove
699
+ ? this . swipeStart
700
+ : noop ,
701
+ [ supportsPassive ? 'onTouchmovePassive' : 'onTouchmove' ] :
702
+ this . dragging && touchMove ? this . swipeMove : noop ,
699
703
onTouchend : touchMove ? this . swipeEnd : noop ,
700
704
onTouchcancel : this . dragging && touchMove ? this . swipeEnd : noop ,
701
705
onKeydown : this . accessibility ? this . keyHandler : noop ,
Original file line number Diff line number Diff line change
1
+ import supportsPassive from '../../../_util/supportsPassive' ;
1
2
import classNames from '../../../_util/classNames' ;
2
3
import { isValidElement } from '../../../_util/props-util' ;
3
4
@@ -51,13 +52,16 @@ const Marks = (_, { attrs }) => {
51
52
52
53
const style = vertical ? bottomStyle : leftStyle ;
53
54
const markStyle = markPointIsObject ? { ...style , ...markPoint . style } : style ;
55
+ const touchEvents = {
56
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] : e => onClickLabel ( e , point ) ,
57
+ } ;
54
58
return (
55
59
< span
56
60
class = { markClassName }
57
61
style = { markStyle }
58
62
key = { point }
59
63
onMousedown = { e => onClickLabel ( e , point ) }
60
- onTouchstart = { e => onClickLabel ( e , point ) }
64
+ { ... touchEvents }
61
65
>
62
66
{ markLabel }
63
67
</ span >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Marks from './Marks';
9
9
import Handle from '../Handle' ;
10
10
import * as utils from '../utils' ;
11
11
import BaseMixin from '../../../_util/BaseMixin' ;
12
+ import supportsPassive from '../../../_util/supportsPassive' ;
12
13
13
14
function noop ( ) { }
14
15
@@ -295,13 +296,18 @@ export default function createSlider(Component) {
295
296
class : `${ prefixCls } -mark` ,
296
297
onClickLabel : disabled ? noop : this . onClickMarkLabel ,
297
298
} ;
299
+ const touchEvents = {
300
+ [ supportsPassive ? 'onTouchstartPassive' : 'onTouchstart' ] : disabled
301
+ ? noop
302
+ : this . onTouchStart ,
303
+ } ;
298
304
return (
299
305
< div
300
306
id = { id }
301
307
ref = { this . saveSlider }
302
308
tabindex = "-1"
303
309
class = { sliderClassName }
304
- onTouchstart = { disabled ? noop : this . onTouchStart }
310
+ { ... touchEvents }
305
311
onMousedown = { disabled ? noop : this . onMouseDown }
306
312
onMouseup = { disabled ? noop : this . onMouseUp }
307
313
onKeydown = { disabled ? noop : this . onKeyDown }
You can’t perform that action at this time.
0 commit comments