Events

Example:

<template>
  <div>
    <vue-final-modal
      v-model="showModal"
      @click-outside="clickOutside"
      @before-open="beforeOpen"
      @opened="opened"
      @before-close="beforeClose"
      @closed="closed"
      @cancel="showModal = false"
    >
      <template v-slot:title>Events Example!</template>
    </vue-final-modal>
    <v-button highlight @click="showModal = true">Open modal</v-button>
  </div>
</template>
<script>
export default {
  data: () => ({
    showModal: false
  }),
  methods: {
    clickOutside() {
      alert('click-outside')
    },
    beforeOpen() {
      alert('beforeOpen')
    },
    opened() {
      alert('opened')
    },
    beforeClose() {
      alert('beforeClose')
    },
    closed() {
      alert('closed')
    }
  }
}
</script>

@click-outside

Emits while modal container on click.

If prop clickToClose is false, the event will still be emitted.

@before-open

Emits while modal is still invisible, but before transition starting.

Further opening of the modal can be blocked from this event listener by calling event.stop() .

@opened

Emits after modal became visible and transition ended.

@before-close

Emits before modal is going to be closed.

Further closing of the modal can be blocked from this event listener by calling event.stop() .

@closed

Emits right before modal is destroyed.

Further after the modal was closed, you can avoid the modal to reset the params to empty object by calling event.stop() .

@drag:start

Emits on drag start.

@drag:move

Emits on drag move.

@drag:end

Emits on drag end.

@resize:start

Emits on resize start.

@resize:move

Emits on resize move.

@resize:end

Emits on resize end.

Edit this page on GitHub Updated at Fri, Feb 3, 2023