Confirm.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div>
  3. <modal class="confirm-modal" title="Confirm Action" :size="'slim'">
  4. <template #body>
  5. <div class="confirm-modal-inner-container">
  6. {{ message }}
  7. </div>
  8. </template>
  9. <template #footer>
  10. <button class="button is-danger" @click="confirmAction()">
  11. <i class="material-icons icon-with-button">warning</i>
  12. Confirm
  13. </button>
  14. </template>
  15. </modal>
  16. </div>
  17. </template>
  18. <script>
  19. import { mapActions } from "vuex";
  20. import { mapModalState, mapModalActions } from "@/vuex_helpers";
  21. export default {
  22. props: {
  23. modalUuid: { type: String, default: "" }
  24. },
  25. computed: {
  26. ...mapModalState("modals/confirm/MODAL_UUID", {
  27. message: state => state.message
  28. })
  29. },
  30. beforeUnmount() {
  31. // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
  32. this.$store.unregisterModule(["modals", "confirm", this.modalUuid]);
  33. },
  34. methods: {
  35. confirmAction() {
  36. this.confirm();
  37. this.closeCurrentModal();
  38. },
  39. ...mapModalActions("modals/confirm/MODAL_UUID", ["confirm"]),
  40. ...mapActions("modalVisibility", ["closeCurrentModal"])
  41. }
  42. };
  43. </script>