This commit is contained in:
Rizky 2024-04-04 23:58:36 +07:00
parent f4d150b089
commit 8309a2971b
3 changed files with 30 additions and 14 deletions

View File

@ -83,17 +83,21 @@ export const EdSidePropInstance: FC<{ meta: IMeta }> = ({ meta }) => {
const arg: any = { ...active.scope };
if (meta.item.script?.props) {
for (const [k, v] of Object.entries(meta.item.script?.props)) {
if (v.value) {
eval(
`try { arg.${k} = ${v.value} } catch(e) { console.error("arg", e); }`
);
}
}
} else if (meta.item.component) {
for (const [k, v] of Object.entries(meta.item.component.props)) {
if (v.valueBuilt) {
eval(
`try { arg.${k} = ${v.valueBuilt} } catch(e) { console.error("arg", e); }`
);
}
}
}
const visible_fn = new Function(
...Object.keys(arg),

View File

@ -31,11 +31,19 @@ export const EdPropInstanceButton: FC<{
const arg: any = { ...active.scope };
if (meta.item.script?.props) {
for (const [k, v] of Object.entries(meta.item.script?.props)) {
eval(`try { arg.${k} = ${v.value} } catch(e) { console.error("arg", e); }`);
if (v.value) {
eval(
`try { arg.${k} = ${v.value} } catch(e) { console.error("arg", e); }`
);
}
}
} else if (meta.item.component) {
for (const [k, v] of Object.entries(meta.item.component.props)) {
eval(`try { arg.${k} = ${v.valueBuilt} } catch(e) { console.error("arg", e); }`);
if (v.valueBuilt) {
eval(
`try { arg.${k} = ${v.valueBuilt} } catch(e) { console.error("arg", e); }`
);
}
}
}

View File

@ -67,16 +67,20 @@ export const EdPropInstanceOptions: FC<{
if (meta.item.script?.props) {
for (const [k, v] of Object.entries(meta.item.script?.props)) {
if (v.value) {
eval(
`try { arg.${k} = ${v.value} } catch(e) { console.error("arg", e); }`
);
}
}
}
if (meta.item.component) {
for (const [k, v] of Object.entries(meta.item.component.props)) {
if (v.valueBuilt) {
eval(
`try { arg.${k} = ${v.valueBuilt} } catch(e) { console.error("arg", e); }`
);
}
if (v.content) {
eval(