diff --git a/packages/amis-editor-core/src/util.ts b/packages/amis-editor-core/src/util.ts index 28b5de469..15c46b3e0 100644 --- a/packages/amis-editor-core/src/util.ts +++ b/packages/amis-editor-core/src/util.ts @@ -134,6 +134,8 @@ export function JSONPipeIn( if (obj.type) { // 处理下历史style数据,整理到themeCss obj = style2ThemeCss(obj); + // 处理下旧数据css被错误转成属性的问题 + obj = clearDirtyCssKey(obj); // 重新生成组件ID if (reGenerateId) { @@ -1237,6 +1239,19 @@ export function style2ThemeCss(data: any) { }; } +export function clearDirtyCssKey(data: any) { + if (!data?.type) { + return data; + } + const temp = {...data}; + Object.keys(temp).forEach(key => { + if (key.startsWith('.') || key.startsWith('#')) { + delete temp[key]; + } + }); + return temp; +} + /** * 从amis数据域中取变量数据 * @param node