[Use] the throttle throttle in search of vue

 

 

 

 

 

 

 

 

 

 

 

Throttle packaging method:

Export function Throttle (the callback) {
     var iNow = 0 ;
     return (value) => {
         var lastINow = new new a Date () .getTime ();
         IF (lastINow -iNow> 300 ) { 
            the callback (value); 
            iNow = new new a Date ( ) .getTime (); 

        } 
    } 
} 

// methods used throttling package search 

// incorporated in the search

 

 

 

Use throttle:

 

 

 

You can not read can watch the video.

 

Guess you like

Origin www.cnblogs.com/yuanjili666/p/11563759.html