vue-debounce-component

debounce directive for vue 2.x.x.
1,537
Install
npm install vue-debounce-component
Latest Version:1.0.3
Vue:2
License:MIT
Last Updated:May 14, 2019
Links: GitHub  ·  npm
Maintainer: shiningjack

vue-debounce-component

simple debounce component for vue

Installation

npm i -S vue-debounce-component

Usage

// main.js
import Vue from 'vue';
import App from './app.vue';
import Debounce from 'vue-debounce-component';

Vue.use(Debounce)

new Vue({
  el: '#app',
  render: h => h(App)
})
<template>
  <Debounce :timeout="300" events="input">
    <input type="text" @input="handleInput" />
  </Debounce>

  
  <Debounce :timeout="300" events="input">
    <my-input type="text" @input="handleInput2"></my-input>
  </Debounce>
</template>

<script>
export default {
  methods: {
    handleInput(val){
      console.log(val, 'val')
    },
    
    handleInput2(val){
      console.log(val, 'val2')
  }
}
</script>

Props

timeout default unit is ms, so :timeout="300" means 300ms, you can specify unit like 1s.ms and s supports only.

events use to specify the event you want to debounce. It allows you to set multiple events using :events="['input','change','click']".

name type default example
timeout String/Number 300 300/300ms/0.3s
events String/Array / input/['input','change']

Related Packages

v-debounce

Input debounce directive for Vue.js

128,534 13
vue2-debounce

This module is a break away from vue-debounce but specifically written for vue2

22,361 0
vue-debounce

A simple vue directive for debounce

1,881,263 178
tiny-debounce

tiny debounce function alternative to lodash.debounce

953,243
vue3-highlight-text

a vue3 directive of highlight text

84,789

Version History

Version Released Vue License
1.0.3 ^2.6.10 MIT
1.0.2 ^2.6.10 MIT
1.0.1 ^2.6.10 MIT
1.0.0 ^2.6.10 MIT