!
export default {
data: { show: false },
methods: {
toggle() {
this.show ? this.close() : this.open();
},
open() {
window.addEventListener('keydown', this.handleEscape);
this.show = true;
},
close() {
window.removeEventListener('keydown', this.handleEscape);
this.show = false;
},
handleEscape(event) {
if (event.code === 'Escape') this.close();
},
},
};