global.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <script setup lang="ts">
  2. import { computed } from 'vue';
  3. import { $t } from '@vben-core/locales';
  4. import { isWindowsOs } from '@vben-core/toolkit';
  5. import SwitchItem from '../switch-item.vue';
  6. defineOptions({
  7. name: 'PreferenceGeneralConfig',
  8. });
  9. const shortcutKeysEnable = defineModel<boolean>('shortcutKeysEnable');
  10. const shortcutKeysGlobalSearch = defineModel<boolean>(
  11. 'shortcutKeysGlobalSearch',
  12. );
  13. const shortcutKeysLogout = defineModel<boolean>('shortcutKeysLogout');
  14. const shortcutKeysPreferences = defineModel<boolean>('shortcutKeysPreferences');
  15. const altView = computed(() => (isWindowsOs() ? 'Alt' : '⌥'));
  16. </script>
  17. <template>
  18. <SwitchItem v-model="shortcutKeysEnable">
  19. {{ $t('preferences.shortcut-keys.title') }}
  20. </SwitchItem>
  21. <SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysGlobalSearch">
  22. {{ $t('preferences.shortcut-keys.search') }}
  23. <template #shortcut>
  24. {{ isWindowsOs() ? 'Ctrl' : '⌘' }}
  25. <kbd> K </kbd>
  26. </template>
  27. </SwitchItem>
  28. <SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysLogout">
  29. {{ $t('preferences.shortcut-keys.logout') }}
  30. <template #shortcut> {{ altView }} Q </template>
  31. </SwitchItem>
  32. <SwitchItem v-if="shortcutKeysEnable" v-model="shortcutKeysPreferences">
  33. {{ $t('preferences.shortcut-keys.preferences') }}
  34. <template #shortcut> {{ altView }} , </template>
  35. </SwitchItem>
  36. </template>