ConfirmModal.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <SmartModal
  3. v-if="show"
  4. dialog
  5. :title="$t('modal.confirm')"
  6. role="dialog"
  7. aria-modal="true"
  8. @close="hideModal"
  9. >
  10. <template #body>
  11. <div class="flex flex-col px-2">
  12. <label>
  13. {{ title }}
  14. </label>
  15. </div>
  16. </template>
  17. <template #footer>
  18. <span>
  19. <ButtonPrimary v-focus :label="yes" @click.native="resolve" />
  20. <ButtonSecondary :label="no" @click.native="hideModal" />
  21. </span>
  22. </template>
  23. </SmartModal>
  24. </template>
  25. <script>
  26. import { defineComponent } from "@nuxtjs/composition-api"
  27. export default defineComponent({
  28. props: {
  29. show: Boolean,
  30. title: { type: String, default: null },
  31. yes: {
  32. type: String,
  33. default() {
  34. return this.$t("action.yes")
  35. },
  36. },
  37. no: {
  38. type: String,
  39. default() {
  40. return this.$t("action.no")
  41. },
  42. },
  43. },
  44. methods: {
  45. hideModal() {
  46. this.$emit("hide-modal")
  47. },
  48. resolve() {
  49. this.$emit("resolve")
  50. this.$emit("hide-modal")
  51. },
  52. },
  53. })
  54. </script>