Skip to content

Commit

Permalink
refactor: delete theme vitePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed May 24, 2022
1 parent 72df73a commit c6d4b77
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 75 deletions.
4 changes: 0 additions & 4 deletions build/vite/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import type { Plugin, ConfigEnv } from 'vite';

// 按需加载样式配置
import { configStylePlugin } from './style';
// 主题切换配置
// import { configThemePlugin } from './theme';
// svg配置
import { configSvgPlugin } from './svg';
// 压缩
Expand All @@ -31,8 +29,6 @@ export function createVitePlugins(isBuild = false, _configEnv: ConfigEnv) {

vitePlugins.push(configStylePlugin());

// vitePlugins.push(configThemePlugin());

vitePlugins.push(configSvgPlugin());

vitePlugins.push(configCompressPlugin('gzip', true));
Expand Down
56 changes: 0 additions & 56 deletions build/vite/plugin/theme.ts

This file was deleted.

16 changes: 1 addition & 15 deletions src/components/Application/AppTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,18 @@
<script setup lang="ts">
import { ref } from 'vue';
import SvgIcon from '../SvgIcon/index.vue';
import { toggleTheme } from '@zougt/vite-plugin-theme-preprocessor/dist/browser-utils';
// import { useAppStore } from '@/store/modules/app';
import { getAppCollapseMenu } from '@/hooks/userAppWindow';
import { useColorMode } from '@vueuse/core';
// const toggleTheme = (scopeName = 'theme-default') => {
// document.documentElement.className = scopeName
// }
// const appStore = useAppStore();
const { appConfigMode } = getAppCollapseMenu();
const isDark = ref<string>(appConfigMode.value.themeMode);
isDark.value = appConfigMode.value.themeMode;
toggleTheme({
scopeName: `variables-theme-${isDark.value}`,
});
const color = useColorMode();
const toggleDarkMode = () => {
isDark.value = isDark.value === 'day' ? 'dark' : 'day';
color.value = color.value === 'dark' ? 'light' : 'dark';
// appConfigMode.value.themeMode = isDark.value;
// appStore.setAppConfigMode(appConfigMode.value);
// toggleTheme({
// scopeName: `variables-theme-${isDark.value}`,
// });
};
</script>

Expand Down

0 comments on commit c6d4b77

Please sign in to comment.