Added possibillity to close or send a modal via keycodes
All checks were successful
the build was successful
All checks were successful
the build was successful
This commit is contained in:
parent
6b4076b29f
commit
d36ecb0ada
|
@ -32,6 +32,18 @@
|
|||
name: 'modal',
|
||||
props: {
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user