seepur/resources/scripts/applications/shared/components/Modal/Modal.vue

42 lines
1.1 KiB
Vue
Raw Normal View History

2020-03-17 22:16:34 +00:00
<template>
2020-05-01 17:24:22 +00:00
<transition name="fade">
<div :class="['modal', { 'is-active': !!isActive }]" v-if="!!isActive">
<div class="modal-background" @click="close()"></div>
<div class="modal-card">
<header class="modal-card-head" v-if="showTitle">
<p class="modal-card-title">{{title}}</p>
<button class="delete" aria-label="close" @click="close()"></button>
</header>
<section class="modal-card-body">
<slot></slot>
</section>
<footer class="modal-card-foot" v-if="showButtons">
<button
class="button is-success"
v-if="!!acceptText"
@click="$emit('accept')"
>{{acceptText}}</button>
<button class="button" @click="close()" v-if="!!rejectText">{{rejectText}}</button>
</footer>
</div>
2020-03-17 22:16:34 +00:00
</div>
2020-05-01 17:24:22 +00:00
</transition>
2020-03-17 22:16:34 +00:00
</template>
<script lang="ts">
export default {
props: ["title", "isActive", "acceptText", "rejectText"],
2020-05-01 17:24:22 +00:00
data() {
2020-03-17 22:16:34 +00:00
return {
showTitle: !!this.title,
showButtons: this.acceptText || this.rejectText
2020-05-01 17:24:22 +00:00
};
2020-03-17 22:16:34 +00:00
},
methods: {
close() {
2020-05-01 17:24:22 +00:00
this.$emit("close");
2020-03-17 22:16:34 +00:00
}
}
};
</script>