This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
IcyNet.eu/src/script/component/Modal.vue

26 lines
528 B
Vue

<template lang="pug">
transition(name='modal')
.modal-mask(@click='close', v-show='show')
.modal-wrapper
.modal-container(@click.stop='')
slot
</template>
<script type="text/javascript">
export default {
props: ['show'],
methods: {
close: function () {
this.$emit('close')
}
},
mounted: function () {
document.addEventListener('keydown', (e) => {
if (this.show && e.keyCode === 27) {
this.close()
}
})
}
}
</script>