An explanation of throttling can be found in hereopen in new window.

Simply put, it is guaranteed to execute the function every N milliseconds. For example, for input events, the throttle function will execute the function at a set time interval during the user input process. This is very different from the debounce mentioned in the previous section.

The throttling of VueRequest is implemented using throttleopen in new window provided by lodashopen in new window, The leading and trailing options default to true. Therefore, two requests may be triggered during the execution interval of the first throttle

You can customize the behavior of throttle via throttleOptions.

As shown below, you only need to provide a throttleInterval to tell us the execution interval of throttling. So when the user enters information, we will initiate a request every 1000 milliseconds.

You can open the console to view the interval of the console printing information

Last Updated: 7/1/2022, 8:28:34 AM
Contributors: John