feat: add font size adj
This commit is contained in:
parent
cd92a79f3c
commit
ab4b26c894
@ -22,6 +22,8 @@ export const overridesPreferences = defineOverridesPreferences({
|
|||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
mode: 'light',
|
mode: 'light',
|
||||||
|
size: 130,
|
||||||
|
menuSize: 22,
|
||||||
},
|
},
|
||||||
|
|
||||||
sidebar: {
|
sidebar: {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@apply text-foreground bg-background font-sans text-[100%];
|
@apply text-foreground bg-background font-sans;
|
||||||
|
|
||||||
font-variation-settings: normal;
|
font-variation-settings: normal;
|
||||||
line-height: 1.15;
|
line-height: 1.15;
|
||||||
@ -23,7 +23,7 @@
|
|||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
text-rendering: optimizelegibility;
|
text-rendering: optimizelegibility;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
font-size: var(--global-size);
|
||||||
/* -webkit-font-smoothing: antialiased;
|
/* -webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale; */
|
-moz-osx-font-smoothing: grayscale; */
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,10 @@
|
|||||||
|
|
||||||
/* 基本文字大小 */
|
/* 基本文字大小 */
|
||||||
--font-size-base: 16px;
|
--font-size-base: 16px;
|
||||||
|
/* size */
|
||||||
|
--global-size: 100%;
|
||||||
|
/* menu文字大小 */
|
||||||
|
--contr-font-size: 14px;
|
||||||
/* =============component & UI============= */
|
/* =============component & UI============= */
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
|
@ -186,6 +186,8 @@ interface ThemePreferences {
|
|||||||
colorSuccess: string;
|
colorSuccess: string;
|
||||||
/** 警告色 */
|
/** 警告色 */
|
||||||
colorWarning: string;
|
colorWarning: string;
|
||||||
|
/** 菜单字体大小 */
|
||||||
|
menuSize?: number;
|
||||||
/** 当前主题 */
|
/** 当前主题 */
|
||||||
mode: ThemeModeType;
|
mode: ThemeModeType;
|
||||||
/** 圆角 */
|
/** 圆角 */
|
||||||
@ -194,6 +196,8 @@ interface ThemePreferences {
|
|||||||
semiDarkHeader: boolean;
|
semiDarkHeader: boolean;
|
||||||
/** 是否开启半深色菜单(只在theme='light'时生效) */
|
/** 是否开启半深色菜单(只在theme='light'时生效) */
|
||||||
semiDarkSidebar: boolean;
|
semiDarkSidebar: boolean;
|
||||||
|
/** 组件大小 */
|
||||||
|
size?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TransitionPreferences {
|
interface TransitionPreferences {
|
||||||
|
@ -440,7 +440,7 @@ $namespace: vben;
|
|||||||
--menu-item-collapse-margin-x: 0px;
|
--menu-item-collapse-margin-x: 0px;
|
||||||
--menu-item-radius: 0px;
|
--menu-item-radius: 0px;
|
||||||
--menu-item-indent: 16px;
|
--menu-item-indent: 16px;
|
||||||
--menu-font-size: 14px;
|
--menu-font-size: var(--contr-font-size);
|
||||||
|
|
||||||
&.is-dark {
|
&.is-dark {
|
||||||
--menu-background-color: hsl(var(--menu));
|
--menu-background-color: hsl(var(--menu));
|
||||||
|
@ -52,6 +52,7 @@ import {
|
|||||||
Theme,
|
Theme,
|
||||||
Widget,
|
Widget,
|
||||||
} from './blocks';
|
} from './blocks';
|
||||||
|
import NumberFieldItem from './blocks/number-field-item.vue';
|
||||||
|
|
||||||
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
|
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
|
||||||
|
|
||||||
@ -78,6 +79,28 @@ const themeColorPrimary = defineModel<string>('themeColorPrimary');
|
|||||||
const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
|
const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
|
||||||
const themeMode = defineModel<ThemeModeType>('themeMode');
|
const themeMode = defineModel<ThemeModeType>('themeMode');
|
||||||
const themeRadius = defineModel<string>('themeRadius');
|
const themeRadius = defineModel<string>('themeRadius');
|
||||||
|
const themeSize = defineModel<number>('themeSize');
|
||||||
|
const fontSize = computed({
|
||||||
|
get() {
|
||||||
|
return themeSize.value;
|
||||||
|
},
|
||||||
|
set(newValue: number) {
|
||||||
|
themeSize.value = newValue;
|
||||||
|
const root = document.documentElement;
|
||||||
|
root.style.setProperty('--global-size', `${newValue}%`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const themeMenuSize = defineModel<number>('themeMenuSize', { default: 14 });
|
||||||
|
const menuSize = computed({
|
||||||
|
get() {
|
||||||
|
return themeMenuSize.value;
|
||||||
|
},
|
||||||
|
set(newValue: number) {
|
||||||
|
themeMenuSize.value = newValue;
|
||||||
|
const root = document.documentElement;
|
||||||
|
root.style.setProperty('--contr-font-size', `${newValue}px`);
|
||||||
|
},
|
||||||
|
});
|
||||||
const themeSemiDarkSidebar = defineModel<boolean>('themeSemiDarkSidebar');
|
const themeSemiDarkSidebar = defineModel<boolean>('themeSemiDarkSidebar');
|
||||||
const themeSemiDarkHeader = defineModel<boolean>('themeSemiDarkHeader');
|
const themeSemiDarkHeader = defineModel<boolean>('themeSemiDarkHeader');
|
||||||
|
|
||||||
@ -281,6 +304,19 @@ async function handleReset() {
|
|||||||
<Block :title="$t('preferences.theme.radius')">
|
<Block :title="$t('preferences.theme.radius')">
|
||||||
<Radius v-model="themeRadius" />
|
<Radius v-model="themeRadius" />
|
||||||
</Block>
|
</Block>
|
||||||
|
<Block :title="$t('preferences.theme.font')">
|
||||||
|
<NumberFieldItem
|
||||||
|
v-model="fontSize"
|
||||||
|
:max="200"
|
||||||
|
:min="100"
|
||||||
|
:step="10"
|
||||||
|
>
|
||||||
|
{{ $t('preferences.theme.fontsize') }}
|
||||||
|
</NumberFieldItem>
|
||||||
|
<NumberFieldItem v-model="menuSize" :max="32" :min="14" :step="2">
|
||||||
|
{{ $t('preferences.theme.menusize') }}
|
||||||
|
</NumberFieldItem>
|
||||||
|
</Block>
|
||||||
<Block :title="$t('preferences.other')">
|
<Block :title="$t('preferences.other')">
|
||||||
<ColorMode
|
<ColorMode
|
||||||
v-model:app-color-gray-mode="appColorGrayMode"
|
v-model:app-color-gray-mode="appColorGrayMode"
|
||||||
|
@ -107,6 +107,8 @@
|
|||||||
"darkHeader": "Semi Dark Header",
|
"darkHeader": "Semi Dark Header",
|
||||||
"weakMode": "Weak Mode",
|
"weakMode": "Weak Mode",
|
||||||
"grayMode": "Gray Mode",
|
"grayMode": "Gray Mode",
|
||||||
|
"size": "Font Size",
|
||||||
|
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"title": "Built-in",
|
"title": "Built-in",
|
||||||
"default": "Default",
|
"default": "Default",
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"normal": "常规",
|
"normal": "常规",
|
||||||
"plain": "朴素",
|
"plain": "朴素",
|
||||||
"rounded": "圆润",
|
"rounded": "圆润",
|
||||||
|
|
||||||
"copyPreferences": "复制偏好设置",
|
"copyPreferences": "复制偏好设置",
|
||||||
"copyPreferencesSuccessTitle": "复制成功",
|
"copyPreferencesSuccessTitle": "复制成功",
|
||||||
"copyPreferencesSuccess": "复制成功,请在 app 下的 `src/preferences.ts`内进行覆盖",
|
"copyPreferencesSuccess": "复制成功,请在 app 下的 `src/preferences.ts`内进行覆盖",
|
||||||
@ -102,6 +103,9 @@
|
|||||||
"title": "主题",
|
"title": "主题",
|
||||||
"radius": "圆角",
|
"radius": "圆角",
|
||||||
"light": "浅色",
|
"light": "浅色",
|
||||||
|
"fontsize": "通用",
|
||||||
|
"menusize": "菜单",
|
||||||
|
"font": "字体大小",
|
||||||
"dark": "深色",
|
"dark": "深色",
|
||||||
"darkSidebar": "深色侧边栏",
|
"darkSidebar": "深色侧边栏",
|
||||||
"darkHeader": "深色顶栏",
|
"darkHeader": "深色顶栏",
|
||||||
|
Loading…
Reference in New Issue
Block a user