fix
This commit is contained in:
parent
374fa9a145
commit
fcb80a49d0
|
|
@ -52,6 +52,14 @@ export const EdPropInstanceOptions: FC<{
|
|||
|
||||
if (cprop.meta?.options || cprop.meta?.optionsBuilt) {
|
||||
if (!local.loaded || !local.metaFn) {
|
||||
const src = (cprop.meta.optionsBuilt || cprop.meta.options || "").trim();
|
||||
const final = `
|
||||
try {
|
||||
const resOpt = ${src.endsWith(";") ? src : `${src};`}
|
||||
|
||||
if (typeof resOpt === 'function') local.metaFn = resOpt;
|
||||
else local.options = resOpt;
|
||||
} catch(e) { console.error(e); }`;
|
||||
try {
|
||||
if (p.site.config.api_url) {
|
||||
if (!p.script.db) p.script.db = dbProxy(p.site.config.api_url);
|
||||
|
|
@ -92,32 +100,11 @@ export const EdPropInstanceOptions: FC<{
|
|||
}
|
||||
}
|
||||
|
||||
const src = (
|
||||
cprop.meta.optionsBuilt ||
|
||||
cprop.meta.options ||
|
||||
""
|
||||
).trim();
|
||||
const res = new Function(
|
||||
...Object.keys(arg),
|
||||
"local",
|
||||
`
|
||||
try {
|
||||
const resOpt = ${src.endsWith(";") ? src : `${src};`}
|
||||
|
||||
if (typeof resOpt === 'function') local.metaFn = resOpt;
|
||||
else local.options = resOpt;
|
||||
} catch(e) { console.error(e); }`
|
||||
);
|
||||
const res = new Function(...Object.keys(arg), "local", final);
|
||||
res(...Object.values(arg), local);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.warn(`
|
||||
try {
|
||||
const resOpt = ${cprop.meta.optionsBuilt || cprop.meta.options};
|
||||
|
||||
if (typeof resOpt === 'function') local.metaFn = resOpt;
|
||||
else local.options = resOpt;
|
||||
} catch(e) { console.error(e); }`);
|
||||
console.warn(final);
|
||||
}
|
||||
} else {
|
||||
local.options = local.loaded;
|
||||
|
|
|
|||
Loading…
Reference in New Issue