global.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script setup lang="ts">
  2. import { computed } from 'vue';
  3. import { $t } from '@vben/locales';
  4. import { isWindowsOs } from '@vben/utils';
  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 shortcutKeysLockScreen = defineModel<boolean>('shortcutKeysLockScreen');
  16. const altView = computed(() => (isWindowsOs() ? 'Alt' : '⌥'));
  17. </script>
  18. <template>
  19. <SwitchItem v-model="shortcutKeysEnable">
  20. {{ $t('preferences.shortcutKeys.title') }}
  21. </SwitchItem>
  22. <SwitchItem
  23. v-model="shortcutKeysGlobalSearch"
  24. :disabled="!shortcutKeysEnable"
  25. >
  26. {{ $t('preferences.shortcutKeys.search') }}
  27. <template #shortcut>
  28. {{ isWindowsOs() ? 'Ctrl' : '⌘' }}
  29. <kbd> K </kbd>
  30. </template>
  31. </SwitchItem>
  32. <SwitchItem v-model="shortcutKeysLogout" :disabled="!shortcutKeysEnable">
  33. {{ $t('preferences.shortcutKeys.logout') }}
  34. <template #shortcut> {{ altView }} Q </template>
  35. </SwitchItem>
  36. <!-- <SwitchItem v-model="shortcutKeysPreferences" :disabled="!shortcutKeysEnable">
  37. {{ $t('preferences.shortcutKeys.preferences') }}
  38. <template #shortcut> {{ altView }} , </template>
  39. </SwitchItem> -->
  40. <SwitchItem v-model="shortcutKeysLockScreen" :disabled="!shortcutKeysEnable">
  41. {{ $t('ui.widgets.lockScreen.title') }}
  42. <template #shortcut> {{ altView }} L </template>
  43. </SwitchItem>
  44. </template>