From dda0cf2df560d7bc4bfe9f8533830b951bf57427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Preu=C3=9F?= Date: Mon, 20 Feb 2023 12:37:21 +0100 Subject: [PATCH] Add loading state --- src/runtime/components/BitinflowButton.vue | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/runtime/components/BitinflowButton.vue b/src/runtime/components/BitinflowButton.vue index 359a439..ae09b67 100644 --- a/src/runtime/components/BitinflowButton.vue +++ b/src/runtime/components/BitinflowButton.vue @@ -4,7 +4,10 @@ :class="computedClass" @click="click" > - + + @@ -17,6 +20,10 @@ export default { type: String, default: 'md' }, + loading: { + type: Boolean, + default: false + }, color: { type: String, default: 'base' @@ -35,12 +42,13 @@ export default { computed: { computedClass: function () { - return `button-text-${this.size} ${this.color}-${this.variant}` + return `button-text-${this.size} ${this.color}-${this.variant} ${this.disabled ? 'disabled' : ''} ${this.loading ? 'loading' : ''}` }, }, methods: { click() { + if (this.disabled || this.loading) return; this.$emit('click'); } } @@ -48,51 +56,72 @@ export default {