This commit is contained in:
Rizky 2024-07-18 10:47:43 +07:00
parent 162bb69908
commit 03b97dac9a
2 changed files with 29 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -152,17 +152,24 @@ export const viEvalProps = (
let val = fn(...Object.values(arg));
if (typeof val === "function") {
val = (...args: any[]) => {
const definer = new Function(
...Object.keys(arg),
`// [${meta.item.name}] ${name}: ${meta.item.id}
if (w.isEditor) {
script.props[name].fn = val;
val = (...args: any[]) => {
if (script) return script.props?.[name].fn(...args);
};
} else {
val = (...args: any[]) => {
const definer = new Function(
...Object.keys(arg),
`// [${meta.item.name}] ${name}: ${meta.item.id}
return ${src}
`
);
);
const fn = definer(...Object.values(arg));
return fn(...args);
};
const fn = definer(...Object.values(arg));
return fn(...args);
};
}
}
arg[name] = val;