Page MenuHomePhorge

No OneTemporary

Size
762 B
Referenced Files
None
Subscribers
None
diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js
index 36cd7f4a37..963f4bcd94 100644
--- a/src/components/modal/modal.js
+++ b/src/components/modal/modal.js
@@ -1,17 +1,21 @@
const Modal = {
props: ['show', 'title'],
methods: {
close: function () {
this.$emit('close')
- }
- },
- mounted: function () {
- document.addEventListener('keydown', (e) => {
+ },
+ handleKeydown: function (e) {
if (this.show && e.keyCode === 27) {
this.close()
}
- })
+ }
+ },
+ mounted: function () {
+ document.addEventListener('keydown', this.handleKeydown)
+ },
+ destroyed: function () {
+ document.removeEventListener('keydown', this.handleKeydown)
}
}
export default Modal

File Metadata

Mime Type
text/x-diff
Expires
Sun, Aug 30, 12:10 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1737631
Default Alt Text
(762 B)

Event Timeline