mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-30 07:06:40 +08:00
fix(projects): fix some grayscale code error
This commit is contained in:
parent
d9020cfba4
commit
a958f3c409
@ -21,6 +21,10 @@ function handleSegmentChange(value: string | number) {
|
|||||||
themeStore.setThemeScheme(value as UnionKey.ThemeScheme);
|
themeStore.setThemeScheme(value as UnionKey.ThemeScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleGrayscaleChange(value: boolean) {
|
||||||
|
themeStore.setGrayscale(value);
|
||||||
|
}
|
||||||
|
|
||||||
const showSiderInverted = computed(() => !themeStore.darkMode && themeStore.layout.mode.includes('vertical'));
|
const showSiderInverted = computed(() => !themeStore.darkMode && themeStore.layout.mode.includes('vertical'));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -46,8 +50,8 @@ const showSiderInverted = computed(() => !themeStore.darkMode && themeStore.layo
|
|||||||
<NSwitch v-model:value="themeStore.sider.inverted" />
|
<NSwitch v-model:value="themeStore.sider.inverted" />
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</Transition>
|
</Transition>
|
||||||
<SettingItem :label="$t('theme.themeSchema.grayscale')">
|
<SettingItem :label="$t('theme.grayscale')">
|
||||||
<NSwitch v-model:value="themeStore.grayscale" />
|
<NSwitch :value="themeStore.grayscale" @update:value="handleGrayscaleChange" />
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -55,9 +55,9 @@ const local: App.I18n.Schema = {
|
|||||||
title: 'Theme Schema',
|
title: 'Theme Schema',
|
||||||
light: 'Light',
|
light: 'Light',
|
||||||
dark: 'Dark',
|
dark: 'Dark',
|
||||||
auto: 'Follow System',
|
auto: 'Follow System'
|
||||||
grayscale: 'Grayscale'
|
|
||||||
},
|
},
|
||||||
|
grayscale: 'Grayscale',
|
||||||
layoutMode: {
|
layoutMode: {
|
||||||
title: 'Layout Mode',
|
title: 'Layout Mode',
|
||||||
vertical: 'Vertical Menu Mode',
|
vertical: 'Vertical Menu Mode',
|
||||||
|
@ -55,9 +55,9 @@ const local: App.I18n.Schema = {
|
|||||||
title: '主题模式',
|
title: '主题模式',
|
||||||
light: '亮色模式',
|
light: '亮色模式',
|
||||||
dark: '暗黑模式',
|
dark: '暗黑模式',
|
||||||
auto: '跟随系统',
|
auto: '跟随系统'
|
||||||
grayscale: '灰度模式'
|
|
||||||
},
|
},
|
||||||
|
grayscale: '灰度模式',
|
||||||
layoutMode: {
|
layoutMode: {
|
||||||
title: '布局模式',
|
title: '布局模式',
|
||||||
vertical: '左侧菜单模式',
|
vertical: '左侧菜单模式',
|
||||||
|
@ -71,6 +71,15 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
|
|||||||
settings.value.themeScheme = themeScheme;
|
settings.value.themeScheme = themeScheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set grayscale value
|
||||||
|
*
|
||||||
|
* @param isGrayscale
|
||||||
|
*/
|
||||||
|
function setGrayscale(isGrayscale: boolean) {
|
||||||
|
settings.value.grayscale = isGrayscale;
|
||||||
|
}
|
||||||
|
|
||||||
/** Toggle theme scheme */
|
/** Toggle theme scheme */
|
||||||
function toggleThemeScheme() {
|
function toggleThemeScheme() {
|
||||||
const themeSchemes: UnionKey.ThemeScheme[] = ['light', 'dark', 'auto'];
|
const themeSchemes: UnionKey.ThemeScheme[] = ['light', 'dark', 'auto'];
|
||||||
@ -154,7 +163,6 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
|
|||||||
themeColors,
|
themeColors,
|
||||||
val => {
|
val => {
|
||||||
setupThemeVarsToHtml();
|
setupThemeVarsToHtml();
|
||||||
|
|
||||||
localStg.set('themeColor', val.primary);
|
localStg.set('themeColor', val.primary);
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
@ -172,6 +180,7 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
|
|||||||
themeColors,
|
themeColors,
|
||||||
naiveTheme,
|
naiveTheme,
|
||||||
settingsJson,
|
settingsJson,
|
||||||
|
setGrayscale,
|
||||||
resetStore,
|
resetStore,
|
||||||
setThemeScheme,
|
setThemeScheme,
|
||||||
toggleThemeScheme,
|
toggleThemeScheme,
|
||||||
|
3
src/typings/app.d.ts
vendored
3
src/typings/app.d.ts
vendored
@ -299,7 +299,8 @@ declare namespace App {
|
|||||||
tokenExpired: string;
|
tokenExpired: string;
|
||||||
};
|
};
|
||||||
theme: {
|
theme: {
|
||||||
themeSchema: { title: string } & Record<UnionKey.ThemeScheme | UnionKey.Grayscale, string>;
|
themeSchema: { title: string } & Record<UnionKey.ThemeScheme, string>;
|
||||||
|
grayscale: string;
|
||||||
layoutMode: { title: string } & Record<UnionKey.ThemeLayoutMode, string>;
|
layoutMode: { title: string } & Record<UnionKey.ThemeLayoutMode, string>;
|
||||||
themeColor: {
|
themeColor: {
|
||||||
title: string;
|
title: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user