refs #3300 Handle shortcut keys in Settings

This commit is contained in:
AkiraFukushima 2022-05-15 21:15:08 +09:00
parent dc8f68b419
commit fd1da2eb3b
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
1 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,6 @@
</el-row>
</el-header>
<el-container>
<div></div>
<el-aside width="240px" class="menu">
<el-menu
:default-active="activeRoute"
@ -45,6 +44,7 @@
<script lang="ts">
import { defineComponent, computed, onMounted } from 'vue'
import { useMagicKeys, whenever } from '@vueuse/core'
import { useRoute, useRouter } from 'vue-router'
import { useStore } from '@/store'
import { MUTATION_TYPES } from '@/store/Settings'
@ -56,6 +56,7 @@ export default defineComponent({
const store = useStore()
const route = useRoute()
const router = useRouter()
const { escape } = useMagicKeys()
const primaryColor = computed(() => store.state.App.theme.primary_color)
const backgroundColor = computed(() => store.state.App.theme.background_color)
@ -67,6 +68,10 @@ export default defineComponent({
router.push(`/${id.value}/settings/general`)
})
whenever(escape, () => {
close()
})
const close = () => {
router.push(`/${id.value}/home`)
}