fix: check if a shortcut has an available function before trying to invoke it
This commit is contained in:
parent
e2d9aa3d7f
commit
8233c8c953
1 changed files with 4 additions and 2 deletions
|
@ -4,9 +4,9 @@
|
||||||
<template v-for="(s, i) in shortcuts" :key="i">
|
<template v-for="(s, i) in shortcuts" :key="i">
|
||||||
<h3>{{ $t(s.title) }}</h3>
|
<h3>{{ $t(s.title) }}</h3>
|
||||||
|
|
||||||
<message class="mb-4">
|
<message class="mb-4" v-if="s.available">
|
||||||
{{
|
{{
|
||||||
s?.available($route)
|
s.available($route)
|
||||||
? $t('keyboardShortcuts.currentPageOnly')
|
? $t('keyboardShortcuts.currentPageOnly')
|
||||||
: $t('keyboardShortcuts.allPages')
|
: $t('keyboardShortcuts.allPages')
|
||||||
}}
|
}}
|
||||||
|
@ -37,6 +37,8 @@ import Message from '@/components/misc/message.vue'
|
||||||
import {KEYBOARD_SHORTCUTS_ACTIVE} from '@/store/mutation-types'
|
import {KEYBOARD_SHORTCUTS_ACTIVE} from '@/store/mutation-types'
|
||||||
import {KEYBOARD_SHORTCUTS as shortcuts} from './shortcuts'
|
import {KEYBOARD_SHORTCUTS as shortcuts} from './shortcuts'
|
||||||
|
|
||||||
|
console.log('s', shortcuts)
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
store.commit(KEYBOARD_SHORTCUTS_ACTIVE, false)
|
store.commit(KEYBOARD_SHORTCUTS_ACTIVE, false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue