import themeConfig from '@/sheep/config/theme.js'; /** * 初始化主题系统 - 简化版 * 在应用启动时调用,应用统一的主题色 #0055A2 */ export function initTheme() { // 应用CSS变量到根元素 const cssVars = themeConfig.getCSSVars(); // 在 uni-app 中设置CSS变量 if (typeof uni !== 'undefined' && uni.setStorageSync) { // 存储主题配置 uni.setStorageSync('theme-config', cssVars); } console.log('主题已初始化,使用主题色:', themeConfig.primary.main); } /** * 获取当前主题色 */ export function getCurrentTheme() { return themeConfig.primary.main; } /** * 获取主题渐变配置 */ export function getThemeGradients() { return themeConfig.gradients; } export default { initTheme, getCurrentTheme, getThemeGradients };