liu
8 天以前 2b695bfabdceccb0ee19c12c8e655bd7f47a6e2f
src/packages/effects/layouts/src/widgets/preferences/blocks/theme/font-size.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { watch } from 'vue';
import { $t } from '..\..\..\..\..\..\..\locales\src';
import { $t } from '../../../../../../../locales/src';
import {
  NumberField,
@@ -9,19 +9,41 @@
  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(
@@ -53,10 +75,10 @@
          <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>