fix: 清除css错误转成key的属性 (#9025)

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
This commit is contained in:
qkiroc 2024-01-16 11:01:37 +08:00 committed by GitHub
parent 293e6f6919
commit f5804b8204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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