【修复】api部分参数错误

This commit is contained in:
chudong
2025-05-19 11:40:06 +08:00
parent 15c75521da
commit 37d19aceb4
65 changed files with 75 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
import { defineComponent } from 'vue'
import { defineComponent, watch } from 'vue'
import {
NConfigProvider,
NDialogProvider,
@@ -21,6 +21,14 @@ export default defineComponent({
const { theme, themeOverrides } = useTheme() // 主题
console.log(theme.value, themeOverrides.value)
watch(
() => themeOverrides.value,
(newVal) => {
console.log('1111', newVal)
},
)
// 国际化配置
return () => (
<NConfigProvider

View File

@@ -52,13 +52,12 @@ export const useTheme = (name?: ThemeName) => {
// 主题继承修改
const themeOverrides = computed(() => {
return themeActiveOverrides.value || {}
return themeActiveOverrides.value?.themeOverrides || {}
})
// 预设配置
const presetsOverrides = computed(() => {
// 如果没有激活的主题,则返回空对象
console.log('presetsOverrides', themeActiveOverrides.value)
if (!themeActiveOverrides.value) return {}
return themeActiveOverrides.value || {}
})
@@ -132,12 +131,16 @@ export const useTheme = (name?: ThemeName) => {
// 加载主题样式
const themeConfig = await themeItem.import()
const themeStyles = await themeItem.styleContent() // 获取主题样式内容
// 加载新样式
if (themeStyles || themeStyles) {
loadDynamicCss(themeStyles as string, 'theme-style')
}
// 更新激活的主题
themeActiveOverrides.value = themeConfig
console.log('themeActiveOverrides', themeActiveOverrides.value)
console.log('themeOverrides', themeOverrides.value)
} catch (error) {
console.error(`加载主题失败 ${themeName}:`, error)
}