visma-meglerfront / sweet-modal-vue

The sweetest library to happen to modals.
Other
757 stars 85 forks source link

How do I destroy the component when the modal is closed? #118

Closed AlexKomMsk closed 3 years ago

AlexKomMsk commented 3 years ago

Hello. I have a problem with content inside modals. It is not destroyed when the window is closed. Screenshot https://yadi.sk/i/Itw3M4ZZfr2UbQ The modal after closing (click outside the window or the cross button) is only hidden. Not destroyed. And the content inside the modal is not destroyed. This creates many problems. Is it possible to destroy the modal (or the content inside it) when the close button is clicked? I am using Vue.

Here is my code:

  <sweet-modal ref="modal">
      <!-- property is_open_modal does not respond when the modal is closed, it remains true -->
      <slot v-if="is_open_modal" name="form"></slot>
    </sweet-modal>
    // How can I call this method when I click on the close button (cross) or click outside the modal?
    closeModal() {
      this.is_open_modal = false;
      this.$refs.modal.close();
    },
AlexKomMsk commented 3 years ago

i use emit 'close'. Thanks