// el-button点击防抖
const install = function(Vue) {
  Vue.directive('debounceClick', {
    inserted(el, binding) {
      el.addEventListener('click', e => {
        if (!el.classList.contains('is-loading')) {
          el.classList.add('is-disabled')
          el.disabled = true
        }
        setTimeout(() => {
          if (!el.classList.contains('is-loading')) {
            el.disabled = false
            el.classList.remove('is-disabled')
          }
        }, 200)
      })
    }
  })
}

export default install
