ModalConfirm.vue 668 Bytes
Newer Older
Anton's avatar
Anton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<template lang="pug">
  modal(ref="modal")
    template(slot="content")
      slot(name="content")
    .q-mt-md.text-center(slot="buttons")
      q-btn.q-mx-sm(@click="confirm") {{ $t('buttons.yes') }}
      q-btn.q-mx-sm(@click="cancel") {{ $t('buttons.no') }}
</template>

<script>
  import Modal from './Modal'
  export default {
    props: ['payload'],
    components: {
      Modal
    },
    methods: {
      show () {
        this.$refs.modal.show()
      },
      confirm () {
        this.$emit('confirm', this.payload)
        this.cancel()
      },
      cancel () {
        this.$emit('cancel')
        this.$refs.modal.close()
      }
    }
  }
</script>