vikunja-frontend/src/components/modal/modal.vue

35 lines
806 B
Vue
Raw Normal View History

2018-09-12 08:22:17 +02:00
<template>
<transition name="modal">
<div class="modal-mask">
<div class="modal-container">
<div class="modal-content">
<div class="header">
<slot name="header"></slot>
</div>
<div class="content">
<slot name="text"></slot>
</div>
<div class="actions">
2018-12-25 16:03:51 +01:00
<button class="button is-danger is-inverted noshadow" @click="$emit('close')">Cancel</button>
<button class="button is-success noshadow" @click="$emit('submit')">Do it!</button>
2018-09-12 08:22:17 +02:00
</div>
</div>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'modal',
mounted: function () {
document.addEventListener('keydown', (e) => {
// Close the model when escape is pressed
if (e.keyCode === 27) {
this.$emit('close')
}
})
}
}
2018-09-12 08:22:17 +02:00
</script>