left/right keys goes to prev/next event

This commit is contained in:
les 2020-12-14 18:48:15 +01:00
parent 9854c7ad97
commit 539c0fa933

View file

@ -249,7 +249,21 @@ export default {
)
}
},
mounted () {
window.addEventListener('keydown', this.keyDown)
},
destroyed () {
window.removeEventListener('keydown', this.keyDown)
},
methods: {
keyDown (ev) {
if (ev.key === 'ArrowRight' && this.event.next) {
this.$router.push(`/event/${this.event.next}`)
}
if (ev.key === 'ArrowLeft' && this.event.prev) {
this.$router.push(`/event/${this.event.prev}`)
}
},
showResource (resource) {
this.showResources = true
this.selectedResource = resource