fixing scope
This commit is contained in:
parent
eb67873f0f
commit
a515918d03
File diff suppressed because one or more lines are too long
|
|
@ -234,7 +234,9 @@ ${tree_usage.map((e) => e.import).join("\n")}
|
|||
|
||||
declare global {
|
||||
${tree_usage.map((e) => e.usage).join("\n")}
|
||||
}`,
|
||||
}
|
||||
export {}
|
||||
`,
|
||||
"typings:tree_usage.ts"
|
||||
);
|
||||
register(
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ export const ViScript: FC<{
|
|||
viEvalProps(vi, meta, is_layout, _pass, depth, parent_key);
|
||||
}
|
||||
|
||||
|
||||
if (meta.item.adv?.html) {
|
||||
return (
|
||||
<ViChild
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { createViLocal } from "./local";
|
|||
import { createViPassProp } from "./passprop";
|
||||
import { devItem } from "./item-dev";
|
||||
import { prodItem } from "./item-prod";
|
||||
|
||||
export const viEvalScript = (
|
||||
vi: {
|
||||
page: VG["page"];
|
||||
|
|
|
|||
|
|
@ -106,9 +106,10 @@ export const createViLocal = (
|
|||
}
|
||||
}, [editorLocalValue[id]]);
|
||||
|
||||
return modifyChild(children, {
|
||||
const result = modifyChild(children, {
|
||||
...meta.script?.scope,
|
||||
[arg.name]: local,
|
||||
});
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -189,12 +189,17 @@ export const modifyChild = (arg: any, passprop?: any, add_props?: any) => {
|
|||
return modify(prop.children, prop, passprop, add_props);
|
||||
};
|
||||
|
||||
const modify = (el: ReactNode, arg: any, passprop?: any, add_props?: any) => {
|
||||
const modify = (
|
||||
el: ReactNode | ReactNode[],
|
||||
arg: any,
|
||||
passprop?: any,
|
||||
add_props?: any
|
||||
): ReactNode | ReactNode[] => {
|
||||
if (isValidElement(el)) {
|
||||
const passarg = { ...arg };
|
||||
delete passarg.children;
|
||||
|
||||
return {
|
||||
const result = {
|
||||
...el,
|
||||
props: {
|
||||
...el.props,
|
||||
|
|
@ -202,6 +207,10 @@ const modify = (el: ReactNode, arg: any, passprop?: any, add_props?: any) => {
|
|||
passprop: { ...passprop, ...passarg },
|
||||
},
|
||||
};
|
||||
|
||||
return result;
|
||||
} else if (Array.isArray(el)) {
|
||||
return modifyChild(el, passprop, add_props);
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue