Added possibillity to close or send a modal via keycodes
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
6b4076b29f
commit
d36ecb0ada
|
@ -32,6 +32,18 @@
|
||||||
name: 'modal',
|
name: 'modal',
|
||||||
props: {
|
props: {
|
||||||
header: ''
|
header: ''
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
document.addEventListener('keydown', (e) => {
|
||||||
|
// Close the model when escape is pressed
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
this.$emit('close')
|
||||||
|
}
|
||||||
|
// Send it when enter is pressed
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
this.$emit('submit')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue