Merge pull request #3339 from h3poteto/iss-3300/preferences

refs #3300 Handle shortcut keys in Preferences
This commit is contained in:
AkiraFukushima 2022-05-07 15:36:17 +09:00 committed by GitHub
commit 1c5cdc643e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>