0👍
You should add Escape
key EventListener
code in the created life cycle hook.
window.addEventListener('keydown', this.toggle);
In methods object :
toggle(event) {
if (event.keyCode === 27) {
this.$modal.show('test');
console.log('esc key pressed');
}
}
Once you done with the requirement, You can destroy this event to prevent memory leaks.
destroyed: function() {
document.removeEventListener('keydown', this.toggle);
}
- [Vuejs]-Unable to acces individual columns after pagination implementation Vue Vuex
- [Vuejs]-Laravel Vue SPA – Social Authentication
Source:stackexchange.com