feat: support custom background colors for sidebar and header (#4151)

* feat: support custom background colors for sidebar and header

* fix: type error
This commit is contained in:
Vben
2024-08-14 21:47:37 +08:00
committed by GitHub
parent 83fcdec37c
commit 8f40d5107c
19 changed files with 148 additions and 47 deletions

View File

@@ -13,9 +13,8 @@ defineOptions({
});
const modelValue = defineModel<string>({ default: 'auto' });
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu', {
default: true,
});
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu');
const themeSemiDarkHeader = defineModel<boolean>('themeSemiDarkHeader');
const THEME_PRESET: Array<{ icon: Component; name: ThemeModeType }> = [
{
@@ -77,5 +76,8 @@ function nameView(name: string) {
>
{{ $t('preferences.theme.darkMenu') }}
</SwitchItem>
<SwitchItem v-model="themeSemiDarkHeader" :disabled="modelValue === 'dark'">
{{ $t('preferences.theme.darkHeader') }}
</SwitchItem>
</div>
</template>

View File

@@ -74,6 +74,7 @@ const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
const themeMode = defineModel<ThemeModeType>('themeMode');
const themeRadius = defineModel<string>('themeRadius');
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu');
const themeSemiDarkHeader = defineModel<boolean>('themeSemiDarkHeader');
const sidebarEnable = defineModel<boolean>('sidebarEnable');
const sidebarWidth = defineModel<number>('sidebarWidth');
@@ -274,6 +275,7 @@ async function handleReset() {
<Block :title="$t('preferences.theme.title')">
<Theme
v-model="themeMode"
v-model:theme-semi-dark-header="themeSemiDarkHeader"
v-model:theme-semi-dark-menu="themeSemiDarkMenu"
/>
</Block>