mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 嵌入naive-ui的css vars,替换windicss的extend color
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user