sd-throttle

1.0.6 • Public • Published

sd-throttle

sd-throttle is an prevent duplicate clicks directive for vue.js.

NPM version

Install

npm install sd-throttle --save

in vue:

// register globally
import throttle from 'sd-throttle'
Vue.use(throttle)
 
// or for a single instance
import throttle from 'sd-throttle'
new Vue({
  directives: {throttle}
})
 

Usage

<button
  v-throttle:[timeout]="isThrottle"
  @click="clickFn('click button')">click</button>
new Vue({
  el: '#app',
  data: {
    // The unit is seconds
    timeout: 1,
    // The default value is true. You can click
    // value is false can't click
    isThrottle: true
  },
   methods: {
    clickFn(val) {
      console.log(val)
    }
  }
});

Readme

Keywords

Package Sidebar

Install

npm i sd-throttle

Weekly Downloads

2

Version

1.0.6

License

ISC

Unpacked Size

340 kB

Total Files

9

Last publish

Collaborators

  • shuidifed