aboutsummaryrefslogtreecommitdiff
path: root/src/components/modal/modal.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/modal/modal.js')
-rw-r--r--src/components/modal/modal.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js
new file mode 100644
index 00000000..36cd7f4a
--- /dev/null
+++ b/src/components/modal/modal.js
@@ -0,0 +1,17 @@
+const Modal = {
+ props: ['show', 'title'],
+ methods: {
+ close: function () {
+ this.$emit('close')
+ }
+ },
+ mounted: function () {
+ document.addEventListener('keydown', (e) => {
+ if (this.show && e.keyCode === 27) {
+ this.close()
+ }
+ })
+ }
+}
+
+export default Modal