vue-event-debounce
[![Build Status](https://travis-ci.org/Qquanwei/vue-event-debounce.svg?branch=master)](https://travis-ci.org/Qquanwei/vue-event-debounce)
Last updated 6 months ago by quanwei .
ISC · Repository · Bugs · Original npm · Tarball
$ cnpm install vue-event-debounce 
SYNC missed versions from official npm registry.

Build Status

vue-event-debounce

will disable component response UI event when a event return promise or generate state is pedding.

Install

npm install vue-event-debounce --save

Usag

...
import VED from 'vue-event-debounce'

Vue.use(VED, { events: ['click'] })
...

and then, in component we can using a bounce event for click!

<template>
  <button v-click="myclick">click me</button>
</template>


<script>
export default {
  ...
  methods: {
    myclick (e) {
      // this is may be a ajax request, or just simple function
      return new Promise(function (resolve) {
        setTimeout(resolve.bind(this, 0), 3000)
      })
    }
  }
  ...
}
</script>

Options

  • events: array , directive name and event name.

Vue.use(VED, { events: ['click', 'keydown', 'keyup']})

will be bind directive v-click v-keydown v-keyup to Vue.

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • co 4.6.0
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |