added disabled on loading for button

This commit is contained in:
Mamalizz
2025-02-11 23:26:04 +03:30
parent 1fd12e4b9e
commit 7c078f9109
+5 -2
View File
@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<Props>(), {
variant: "solid",
size: "lg",
});
const { variant, size } = toRefs(props);
const { variant, size, loading } = toRefs(props);
// computed
const classes = computed(() => {
@@ -30,12 +30,15 @@ const classes = computed(() => {
"btn-lg": size.value === "lg",
"btn-md": size.value === "md",
},
{
"pointer-events-none opacity-80 cursor-not-allowed": loading.value,
},
];
});
</script>
<template>
<button :class="classes">
<button :class="classes" :disabled="loading">
<Icon v-if="!loading && startIcon" :name="startIcon" />
<slot v-if="!loading" />
<Icon v-if="!loading && endIcon" :name="endIcon" />