We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ed48e9b + 80b5ced commit 64e93e9Copy full SHA for 64e93e9
src/vue-simple-context-menu.vue
@@ -89,17 +89,18 @@ export default {
89
item: this.item,
90
option: option
91
})
92
+ },
93
+ onEscKeyRelease (event) {
94
+ if (event.keyCode === 27) {
95
+ this.hideContextMenu();
96
+ }
97
}
98
},
99
mounted () {
- document.body.addEventListener('keyup', e => {
- if (e.keyCode === 27) {
- this.hideContextMenu()
- }
- })
100
+ document.body.addEventListener('keyup', this.onEscKeyRelease);
101
102
beforeDestroy () {
- document.removeEventListener('keyup', this.hideContextMenu());
103
+ document.removeEventListener('keyup', this.onEscKeyRelease);
104
105
106
</script>
0 commit comments