mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-05 15:56:05 +08:00
feat(projects): support theme presets to only set partial content.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import { defu } from 'defu';
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { themeSettings } from '@/theme/settings';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -76,7 +78,9 @@ const getPresetDesc = (preset: ThemePreset): string => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyPreset = ({ themeScheme, grayscale, colourWeakness, layout, watermark, ...rest }: ThemePreset): void => {
|
const applyPreset = (preset: ThemePreset): void => {
|
||||||
|
const mergedPreset = defu(preset, themeSettings);
|
||||||
|
const { themeScheme, grayscale, colourWeakness, layout, watermark, ...rest } = mergedPreset;
|
||||||
themeStore.setThemeScheme(themeScheme);
|
themeStore.setThemeScheme(themeScheme);
|
||||||
themeStore.setGrayscale(grayscale);
|
themeStore.setGrayscale(grayscale);
|
||||||
themeStore.setColourWeakness(colourWeakness);
|
themeStore.setColourWeakness(colourWeakness);
|
||||||
|
|||||||
Reference in New Issue
Block a user