mirror of
https://github.com/certd/certd.git
synced 2026-05-15 12:37:30 +08:00
25 lines
423 B
Vue
25 lines
423 B
Vue
<template>
|
|
<a-button :loading="loading" @click="onClick">
|
|
<slot></slot>
|
|
</a-button>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from "vue";
|
|
const props = defineProps<{
|
|
click?: () => Promise<void>;
|
|
}>();
|
|
|
|
const loading = ref(false);
|
|
async function onClick() {
|
|
loading.value = true;
|
|
try {
|
|
if (props.click) {
|
|
await props.click();
|
|
}
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
</script>
|