element-ui-stop-multiple-click
v0.0.6
Published
![npm](https://img.shields.io/npm/v/vue-stop-multiple-click) [![gzip size](http://img.badgesize.io/https://unpkg.com/vue-stop-multiple-click/vue-prevent-multiple-click.js?compression=gzip&label=gzip%20size&style=flat-square)](https://unpkg.com/vue-stop-mu
Downloads
13
Maintainers
Readme
vue-stop-multiple-click
a simple way prevent button multiple clicks.
一个非常简单的方式,防止按钮重复点击。
使用一个指令,像这样 v-click-async="ajaxPromiseFn"
把 Promise 函数传入,程序就能自动防止按钮重复点击了。按钮被点击后,一定要等到异步函数结束,才能再次点击,从而解决了重复点击的问题。
Usage
const StopMultipleClick = require('element-ui-stop-multiple-click')
Vue.directive('clickAsync', StopMultipleClick)
<button v-click-async="ajaxPromiseFn">a simple way prevent button multiple clicks</button>
or use CDN script:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/vue-prevent-multiple-click.min.js"></script>
<script>
var StopMultipleClick = window.StopMultipleClick
Vue.directive('clickAsync', StopMultipleClick)
</script>
<button v-click-async="ajaxPromiseFn">button will auto prevent multiple clicks</button>