58 lines
1.6 KiB
Vue
Raw Normal View History

<template>
<base-modal :show="show" @close="$emit('close')">
<template #content>
<p v-if="title" class="title is-4" v-text="title" />
<slot name="modal-content" />
</template>
<template #footer>
<a class="card-footer-item has-text-dark" @click="$emit('close')">
<mdicon class="icon" name="cancel" size="16" />
<span class="is-size-7" v-text="close_action" />
</a>
<a
v-if="delete_action"
class="card-footer-item has-background-danger has-text-white has-text-weight-bold"
@click="$emit('delete')"
>
<mdicon class="icon" name="delete" size="16" />
<span class="is-size-7" v-text="delete_action" />
</a>
<a
v-if="ok_action"
class="card-footer-item has-background-info has-text-white has-text-weight-bold"
@click="$emit('ok')"
>
<mdicon class="icon" name="check" size="16" />
<span class="is-size-7" v-text="ok_action" />
</a>
</template>
</base-modal>
</template>
<script>
import BaseModal from '@/components/BaseModal.vue'
export default {
name: 'ModalDialog',
components: { BaseModal },
2024-02-27 17:18:58 +01:00
props: {
2024-04-23 21:44:35 +02:00
close_action: { default: '', type: String },
2024-02-28 13:10:08 +01:00
delete_action: { default: '', type: String },
ok_action: { default: '', type: String },
2024-02-27 17:18:58 +01:00
show: Boolean,
2024-02-28 13:10:08 +01:00
title: { required: true, type: String }
2024-02-27 17:18:58 +01:00
},
emits: ['delete', 'close', 'ok'],
watch: {
show() {
const { classList } = document.querySelector('html')
if (this.show) {
classList.add('is-clipped')
} else {
classList.remove('is-clipped')
}
}
}
}
</script>