|
@@ -22,8 +22,23 @@ export class CompController{
|
|
|
this.state.content = designData.content || [];
|
|
|
const arr = this.state.content;
|
|
|
this.designCompMap.clear();
|
|
|
- while (arr.length) {
|
|
|
- const item = arr[0];
|
|
|
+
|
|
|
+ const ParseComp = (obj:any)=> {
|
|
|
+ if (typeof obj != "object") return;
|
|
|
+ //作为组件
|
|
|
+ if (obj.id && obj.compKey && obj.value) {
|
|
|
+ this.designCompMap.set(obj.id, obj);
|
|
|
+ } else {
|
|
|
+ for (const c in obj) {
|
|
|
+ ParseComp(c);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let index = arr.length
|
|
|
+ while (index--) {
|
|
|
+ const item = arr[index];
|
|
|
+ ParseComp(item.value)
|
|
|
this.designCompMap.set(item.id, item);
|
|
|
}
|
|
|
}
|