close modal on esc press

This commit is contained in:
busti 2019-12-29 18:08:09 +01:00
parent ca38616395
commit 8c759c4f23

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="modal" tabindex="-1"> <div class="modal" tabindex="-1" @keyup.esc="$emit('close')">
<div class="modal-dialog modal-xl"> <div class="modal-dialog modal-xl">
<div class="modal-content bg-dark text-light border-secondary"> <div class="modal-content bg-dark text-light border-secondary">
<div class="modal-header"> <div class="modal-header">
@ -30,7 +30,10 @@
<script> <script>
export default { export default {
name: 'Modal', name: 'Modal',
props: ['title'] props: ['title'],
mounted() {
this.$el.focus();
}
}; };
</script> </script>