refactor(projects): 嵌入naive-ui的css vars,替换windicss的extend color

This commit is contained in:
Soybean
2021-11-17 12:28:53 +08:00
parent 27f600c467
commit 2869b4cd33
13 changed files with 114 additions and 132 deletions

View File

@ -6,16 +6,18 @@
:theme="dark"
:theme-overrides="theme.themeOverrids"
>
<n-loading-bar-provider>
<n-dialog-provider>
<n-notification-provider>
<n-message-provider>
<slot></slot>
<app-provider-content />
</n-message-provider>
</n-notification-provider>
</n-dialog-provider>
</n-loading-bar-provider>
<n-element class="h-full">
<n-loading-bar-provider>
<n-dialog-provider>
<n-notification-provider>
<n-message-provider>
<slot></slot>
<app-provider-content />
</n-message-provider>
</n-notification-provider>
</n-dialog-provider>
</n-loading-bar-provider>
</n-element>
</n-config-provider>
</template>
@ -23,18 +25,18 @@
import { computed, watch } from 'vue';
import {
NConfigProvider,
darkTheme,
zhCN,
dateZhCN,
NElement,
NLoadingBarProvider,
NDialogProvider,
NNotificationProvider,
NMessageProvider
NMessageProvider,
darkTheme,
zhCN,
dateZhCN
} from 'naive-ui';
import { useDark } from '@vueuse/core';
import { AppProviderContent } from '@/components';
import { useThemeStore } from '@/store';
import { addColorAlpha } from '@/utils';
const osDark = useDark();
const theme = useThemeStore();
@ -43,13 +45,6 @@ const { handleDarkMode } = useThemeStore();
/** 系统暗黑模式 */
const dark = computed(() => (theme.darkMode ? darkTheme : undefined));
// 主题颜色
const primary = computed(() => theme.themeColor);
const primaryWithAlpha = computed(() => {
const alpha = theme.darkMode ? 0.15 : 0.1;
return addColorAlpha(primary.value, alpha);
});
// 操作系统的暗黑模式
watch(
osDark,
@ -61,18 +56,4 @@ watch(
}
);
</script>
<style>
/* 全局与主题颜色相关 */
.g_text-primary {
color: v-bind(primary);
}
.g_bg-primary {
background-color: v-bind(primary);
}
.g_bg-primary_active {
background-color: v-bind(primaryWithAlpha);
}
.g_border-primary {
border-color: v-bind(primary);
}
</style>
<style></style>