Skip to content

Commit 9da847f

Browse files
Azir-11honghuangdc
authored andcommitted
feat(projects): support theme presets to only set partial content.
1 parent c472a94 commit 9da847f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/layouts/modules/theme-drawer/modules/preset/modules/theme-preset.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script setup lang="ts">
22
import { computed } from 'vue';
3+
import { defu } from 'defu';
34
import { useThemeStore } from '@/store/modules/theme';
5+
import { themeSettings } from '@/theme/settings';
46
import { $t } from '@/locales';
57
68
defineOptions({
@@ -76,7 +78,9 @@ const getPresetDesc = (preset: ThemePreset): string => {
7678
}
7779
};
7880
79-
const applyPreset = ({ themeScheme, grayscale, colourWeakness, layout, watermark, ...rest }: ThemePreset): void => {
81+
const applyPreset = (preset: ThemePreset): void => {
82+
const mergedPreset = defu(preset, themeSettings);
83+
const { themeScheme, grayscale, colourWeakness, layout, watermark, ...rest } = mergedPreset;
8084
themeStore.setThemeScheme(themeScheme);
8185
themeStore.setGrayscale(grayscale);
8286
themeStore.setColourWeakness(colourWeakness);

0 commit comments

Comments
 (0)