This commit is contained in:
Rizky 2023-10-17 20:24:14 +07:00
parent 0a7b744846
commit ddbe91f17a
3 changed files with 37 additions and 4 deletions

View File

@ -29,7 +29,7 @@ export type ItemMeta = {
isLayout: boolean; isLayout: boolean;
render?: () => void; render?: () => void;
mounted?: boolean; mounted?: boolean;
pendingRender: boolean; pendingRender?: boolean;
}; };
export type LPage = { export type LPage = {

View File

@ -27,7 +27,6 @@ export const treePropEval = (
const w = window as any; const w = window as any;
const finalScope = mergeScopeUpwards(p, id, { _scopeIndex }); const finalScope = mergeScopeUpwards(p, id, { _scopeIndex });
const args = { const args = {
...w.exports, ...w.exports,
...finalScope, ...finalScope,
@ -75,8 +74,9 @@ export const treePropEval = (
_scopeIndex?: Record<string, any>; _scopeIndex?: Record<string, any>;
}) => { }) => {
if (prop.content) { if (prop.content) {
if (p.treeMeta[prop.content.id]) { const meta = p.treeMeta[prop.content.id];
p.treeMeta[prop.content.id].parent_id = parent_id; if (meta) {
meta.parent_id = parent_id;
return ( return (
<LItem <LItem
id={prop.content.id} id={prop.content.id}

View File

@ -59,6 +59,15 @@ export const treeScopeEval = (
} }
} }
if (
meta.item.name === "label" &&
p.treeMeta[meta.parent_id].item.name === "tree_lv_2" &&
!finalScope.lv2_item
) {
const parent = p.treeMeta[meta.parent_id];
console.log("final_scope", meta, p.treeMeta[parent.parent_id]);
}
const output = { jsx: null as any }; const output = { jsx: null as any };
args = { args = {
...w.exports, ...w.exports,
@ -124,6 +133,16 @@ export const mergeScopeUpwards = (
const finalScope: any = {}; const finalScope: any = {};
const parent = p.treeMeta[meta.parent_id];
const condition =
meta.item.name === "label" &&
parent.item.name === "tree_lv_2" &&
p.treeMeta[parent.parent_id].item.name !== "tree_lv_1";
if (condition) {
console.log("------------------------");
}
while (cur) { while (cur) {
let scope = null; let scope = null;
@ -135,6 +154,14 @@ export const mergeScopeUpwards = (
} }
} }
if (condition) {
console.log(
cur.item.name,
cur.item.id,
indexedScope ? indexedScope.idx : indexedScope
);
}
if (indexedScope || cur.scope || cur.comp?.propval) { if (indexedScope || cur.scope || cur.comp?.propval) {
scope = { ...cur.scope, ...indexedScope, ...cur.comp?.propval }; scope = { ...cur.scope, ...indexedScope, ...cur.comp?.propval };
@ -150,6 +177,11 @@ export const mergeScopeUpwards = (
cur = p.treeMeta[cur.parent_id]; cur = p.treeMeta[cur.parent_id];
} }
if (condition) {
console.log(finalScope.lv2_item);
}
return finalScope; return finalScope;
}; };
@ -192,6 +224,7 @@ const createPassProp = (
return modifyChildIndex(arg.children, scopeIndex); return modifyChildIndex(arg.children, scopeIndex);
} }
if (!meta.scope) { if (!meta.scope) {
meta.scope = {}; meta.scope = {};
} }