2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
|
|
|
<transition name="modal-fade">
|
2019-12-14 12:44:35 +00:00
|
|
|
<div v-if="show" class="modal-mask" transition="modal" @click="close">
|
|
|
|
<i class="ion-android-close modal--close" @click="close"></i>
|
2019-08-14 09:48:44 +00:00
|
|
|
<div class="modal-container" :class="className" @click.stop>
|
2019-12-16 12:53:14 +00:00
|
|
|
<slot />
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
show: Boolean,
|
|
|
|
onClose: Function,
|
|
|
|
className: String,
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-12-14 12:44:35 +00:00
|
|
|
document.addEventListener('keydown', e => {
|
2019-08-14 09:48:44 +00:00
|
|
|
if (this.show && e.keyCode === 27) {
|
|
|
|
this.onClose();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2019-12-14 12:44:35 +00:00
|
|
|
methods: {
|
|
|
|
close() {
|
|
|
|
this.onClose();
|
|
|
|
},
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
};
|
|
|
|
</script>
|