Added possibillity to close or send a modal via keycodes
the build was successful Details

This commit is contained in:
konrad 2017-11-23 16:17:06 +01:00 committed by kolaente
parent 6b4076b29f
commit d36ecb0ada
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 12 additions and 0 deletions

View File

@ -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>