feat: add shortcut keys

This commit is contained in:
vben
2024-05-25 20:02:21 +08:00
parent 666371ed67
commit 977d108ca0
12 changed files with 104 additions and 12 deletions

View File

@@ -13,6 +13,7 @@ defineOptions({
const locale = defineModel<string>('locale');
const dynamicTitle = defineModel<boolean>('dynamicTitle');
const shortcutKeys = defineModel<boolean>('shortcutKeys');
const localeItems: SelectListItem[] = staticPreference.supportLanguages.map(
(item) => ({
@@ -29,4 +30,7 @@ const localeItems: SelectListItem[] = staticPreference.supportLanguages.map(
<SwitchItem v-model="dynamicTitle">
{{ $t('preference.dynamic-title') }}
</SwitchItem>
<SwitchItem v-model="shortcutKeys">
{{ $t('preference.shortcut-key') }}
</SwitchItem>
</template>

View File

@@ -54,9 +54,11 @@ function updateLocale(value: string) {
:locale="preference.locale"
:navigation-accordion="preference.navigationAccordion"
:navigation-style="preference.navigationStyle"
:shortcut-keys="preference.shortcutKeys"
:navigation-split="preference.navigationSplit"
:side-collapse-show-title="preference.sideCollapseShowTitle"
:page-transition-enable="preference.pageTransitionEnable"
@update:shortcut-keys="(value) => handleUpdate('shortcutKeys', value)"
@update:navigation-style="(value) => handleUpdate('navigationStyle', value)"
@update:navigation-accordion="
(value) => handleUpdate('navigationAccordion', value)

View File

@@ -62,6 +62,7 @@ const pageTransitionEnable = defineModel<boolean>('pageTransitionEnable');
const layout = defineModel<LayoutType>('layout');
const contentCompact = defineModel<string>('contentCompact');
const sideVisible = defineModel<boolean>('sideVisible');
const shortcutKeys = defineModel<boolean>('shortcutKeys');
const tabsVisible = defineModel<boolean>('tabsVisible');
const tabsIcon = defineModel<boolean>('tabsIcon');
// const logoVisible = defineModel<boolean>('logoVisible');
@@ -95,6 +96,10 @@ const tabs = computed((): SegmentedItem[] => {
label: $t('preference.general'),
value: 'general',
},
// {
// label: $t('preference.shortcut-key'),
// value: 'shortcutKey',
// },
];
});
@@ -233,6 +238,24 @@ function handleReset() {
<General
v-model:locale="locale"
v-model:dynamic-title="dynamicTitle"
v-model:shortcut-keys="shortcutKeys"
/>
</Block>
<Block :title="$t('preference.animation')">
<Animation
v-model:page-progress="pageProgress"
v-model:page-transition="pageTransition"
v-model:page-transition-enable="pageTransitionEnable"
/>
</Block>
</template>
<template #shortcutKey>
<Block :title="$t('preference.general')">
<General
v-model:locale="locale"
v-model:dynamic-title="dynamicTitle"
v-model:shortcut-keys="shortcutKeys"
/>
</Block>