26 lines
528 B
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>
|