Confirm.vue 926 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 { mapState, mapActions } from "vuex";
  20. import Modal from "../Modal.vue";
  21. export default {
  22. components: { Modal },
  23. computed: {
  24. ...mapState("modals/confirm", {
  25. message: state => state.message
  26. })
  27. },
  28. beforeUnmount() {
  29. this.updateConfirmMessage("");
  30. },
  31. methods: {
  32. confirmAction() {
  33. this.$emit("confirmed");
  34. this.closeCurrentModal();
  35. },
  36. ...mapActions("modals/confirm", ["updateConfirmMessage"]),
  37. ...mapActions("modalVisibility", ["closeCurrentModal"])
  38. }
  39. };
  40. </script>