| | |
| | | <script setup lang="ts"> |
| | | import { watch } from 'vue'; |
| | | |
| | | import { $t } from '..\..\..\..\..\..\..\locales\src'; |
| | | import { $t } from '../../../../../../../locales/src'; |
| | | |
| | | import { |
| | | NumberField, |
| | |
| | | NumberFieldDecrement, |
| | | NumberFieldIncrement, |
| | | NumberFieldInput, |
| | | } from '..\..\..\..\..\..\..\@core\ui-kit\shadcn-ui\src'; |
| | | } from '../../../../../../../@core/ui-kit/shadcn-ui/src'; |
| | | |
| | | defineOptions({ |
| | | name: 'PreferenceFontSize', |
| | | }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | /** 最大值 */ |
| | | max?: number; |
| | | /** 最小值 */ |
| | | min?: number; |
| | | /** 步长 */ |
| | | step?: number; |
| | | /** 提示文案,默认使用全局字体大小提示 */ |
| | | tip?: string; |
| | | /** 数值单位 */ |
| | | unit?: string; |
| | | }>(), |
| | | { |
| | | max: 22, |
| | | min: 15, |
| | | step: 1, |
| | | tip: '', |
| | | unit: 'px', |
| | | }, |
| | | ); |
| | | |
| | | const modelValue = defineModel<number>({ |
| | | default: 16, |
| | | }); |
| | | |
| | | const min = 15; |
| | | const max = 22; |
| | | const step = 1; |
| | | const min = props.min; |
| | | const max = props.max; |
| | | const step = props.step; |
| | | |
| | | // 限制输入值在 min 和 max 之间 |
| | | watch( |
| | |
| | | <NumberFieldIncrement /> |
| | | </NumberFieldContent> |
| | | </NumberField> |
| | | <span class="text-xs whitespace-nowrap text-muted-foreground">px</span> |
| | | <span class="text-xs whitespace-nowrap text-muted-foreground">{{ props.unit }}</span> |
| | | </div> |
| | | <div class="text-xs text-muted-foreground"> |
| | | {{ $t('preferences.theme.fontSizeTip') }} |
| | | {{ props.tip || $t('preferences.theme.fontSizeTip') }} |
| | | </div> |
| | | </div> |
| | | </template> |