refs #3300 Handle shortcut keys in Preferences

This commit is contained in:
AkiraFukushima 2022-05-07 15:30:43 +09:00
parent 225ab4a56f
commit 38d7a4bab8
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 7 additions and 2 deletions

View File

@ -57,6 +57,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, computed } from 'vue' import { defineComponent, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useMagicKeys, whenever } from '@vueuse/core'
import { useStore } from '@/store' import { useStore } from '@/store'
export default defineComponent({ export default defineComponent({
@ -65,10 +66,15 @@ export default defineComponent({
const store = useStore() const store = useStore()
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const { escape } = useMagicKeys()
const primaryColor = computed(() => store.state.App.theme.primary_color) const primaryColor = computed(() => store.state.App.theme.primary_color)
const backgroundColor = computed(() => store.state.App.theme.background_color) const backgroundColor = computed(() => store.state.App.theme.background_color)
whenever(escape, () => {
close()
})
const close = () => { const close = () => {
router.push({ path: '/', query: { redirect: 'home' } }) router.push({ path: '/', query: { redirect: 'home' } })
} }

View File

@ -134,8 +134,7 @@ export default defineComponent({
notifyPollVote, notifyPollVote,
notifyPollExpired notifyPollExpired
} }
}, }
created() {}
}) })
</script> </script>