File tree Expand file tree Collapse file tree 1 file changed +29
-23
lines changed
components/vc-virtual-list/hooks Expand file tree Collapse file tree 1 file changed +29
-23
lines changed Original file line number Diff line number Diff line change 11import supportsPassive from '../../_util/supportsPassive' ;
2- import { watch , Ref } from 'vue' ;
2+ import { watch , Ref , onMounted } from 'vue' ;
33
44const SMOOTH_PTG = 14 / 15 ;
55
@@ -80,28 +80,34 @@ export default function useMobileTouchMove(
8080 }
8181 } ;
8282
83- watch ( inVirtual , val => {
84- listRef . value . removeEventListener (
85- 'touchstart' ,
86- onTouchStart ,
87- supportsPassive
88- ? ( {
89- passive : false ,
90- } as EventListenerOptions )
91- : false ,
83+ onMounted ( ( ) => {
84+ watch (
85+ inVirtual ,
86+ val => {
87+ listRef . value . removeEventListener (
88+ 'touchstart' ,
89+ onTouchStart ,
90+ supportsPassive
91+ ? ( {
92+ passive : false ,
93+ } as EventListenerOptions )
94+ : false ,
95+ ) ;
96+ cleanUpEvents ( ) ;
97+ clearInterval ( interval ) ;
98+ if ( val ) {
99+ listRef . value . addEventListener (
100+ 'touchstart' ,
101+ onTouchStart ,
102+ supportsPassive
103+ ? ( {
104+ passive : false ,
105+ } as EventListenerOptions )
106+ : false ,
107+ ) ;
108+ }
109+ } ,
110+ { immediate : true } ,
92111 ) ;
93- cleanUpEvents ( ) ;
94- clearInterval ( interval ) ;
95- if ( val ) {
96- listRef . value . addEventListener (
97- 'touchstart' ,
98- onTouchStart ,
99- supportsPassive
100- ? ( {
101- passive : false ,
102- } as EventListenerOptions )
103- : false ,
104- ) ;
105- }
106112 } ) ;
107113}
You can’t perform that action at this time.
0 commit comments