import Vue from 'vue'
//防抖
//防抖示例
/* <div>
<span>{{debounceTest}}</span>
<a-button v-debounce="[numADD]">+__+</a-button>
    </div>*/
Vue.directive('debounce', {
    inserted: function (el, binding) {
        let [fn, event = 'click', time = 300] = binding.value
        let timer
        el.addEventListener(event, () => {
            timer&& clearTimeout(timer)
            timer =setTimeout(() => fn(), time)
        })
    }
})
