ConfirmModal.vue 1.0 KB

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