Just in case anyone else is interested, here is how it works:
Add the following under mounted
in your Vue file:
document.addEventListener('keydown', this.keyListener)
and here is how the handler works:
keyListener: function (e) {
if (e.key === '1' && (e.ctrlKey || e.metaKey)) {
this.$root.$emit('userAlert', 'fatal', 'A message from the president', 'Obey the president!')
} else if (e.key === '2' && (e.ctrlKey || e.metaKey)) {
this.$root.$emit('userNotify', 'Ivey sent you a new message', '5 min ago.', 'notifications_active')
} else if (e.key === '3' && (e.ctrlKey || e.metaKey)) {
this.$root.$emit('showProgress', 0.35)
} else if (e.key === '4' && (e.ctrlKey || e.metaKey)) {
this.$root.$emit('showProgress', 0.70)
} else if (e.key === '5' && (e.ctrlKey || e.metaKey)) {
this.$root.$emit('showProgress', 1.00)
}
}
Works like a charm
Cheers,
Michael