<template>
  <a-button v-bind="$attrs" :loading="loading" @click="hanldeClick">
    <slot />
  </a-button>
</template>
<script lang="ts" setup>
defineOptions({
  name: 'AsyncButton'
})
const emit = defineEmits(['click'])
const loading = ref<boolean>(false)
const hanldeClick = (e: Event) => {
  loading.value = true
  emit('click', () => {
    loading.value = false
  }, e)
}
</script>