diff --git a/src/webapi/datascreen.ts b/src/webapi/datascreen.ts index 42757a0..7e47e55 100644 --- a/src/webapi/datascreen.ts +++ b/src/webapi/datascreen.ts @@ -247,8 +247,10 @@ export function getBaseConfig(): Record { } const body = code.slice(bodyStart, bodyEnd) // 解析: `width: 1920, ...` 转成 JS 对象 + // 注: web 端 config 引用了 `theme: themeList` (同级 export), Function 不会跨文件 import. + // 在 scope 里 mock 一下 themeList = {} 即可, theme 字段对 save payload 暂时不影响. // eslint-disable-next-line no-new-func - const parsed = Function(`return ({${body}})`)() + const parsed = Function('themeList', `return ({${body}})`)({}) if (parsed && typeof parsed === 'object') { cachedBaseConfig = parsed as Record } else { @@ -382,7 +384,7 @@ export function getComponentDefaults(prop: string): ComponentDefaults | null { if (!prop || typeof prop !== 'string') return null if (componentFileCache.has(prop)) { const cached = componentFileCache.get(prop)! - return { ...cached, prop } + return { ...cached, prop, isOptionConfig: true as const } } const filePath = join(DATASCREEN_OPTION_COMPONENTS_DIR, prop + '.vue')