feat: loading states for modal buttons (#2268)

This commit is contained in:
kyteinsky
2022-04-20 23:48:25 +05:30
committed by GitHub
parent 7bf76a5812
commit 2452b1be4b
13 changed files with 242 additions and 177 deletions

View File

@@ -16,7 +16,12 @@
</template>
<template #footer>
<span>
<ButtonPrimary v-focus :label="yes" @click.native="resolve" />
<ButtonPrimary
v-focus
:label="yes"
:loading="!!loadingState"
@click.native="resolve"
/>
<ButtonSecondary :label="no" @click.native="hideModal" />
</span>
</template>
@@ -42,14 +47,15 @@ export default defineComponent({
return this.$t("action.no")
},
},
loadingState: { type: Boolean, default: null },
},
methods: {
hideModal() {
this.$emit("hide-modal")
},
resolve() {
this.$emit("resolve")
this.$emit("hide-modal")
this.$emit("resolve", this.title)
if (this.loadingState === null) this.$emit("hide-modal")
},
},
})