From da426635ee632d796de4427afe4cf5cfba65fe93 Mon Sep 17 00:00:00 2001 From: Katherine Date: Mon, 23 Sep 2024 17:19:27 +0800 Subject: [PATCH] fix: markdown report error with each (#5305) --- .../src/schema-component/common/utils/uitls.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/client/src/schema-component/common/utils/uitls.tsx b/packages/core/client/src/schema-component/common/utils/uitls.tsx index 6dfc64bbe7..0639fe6dd5 100644 --- a/packages/core/client/src/schema-component/common/utils/uitls.tsx +++ b/packages/core/client/src/schema-component/common/utils/uitls.tsx @@ -162,15 +162,15 @@ const getVariablesData = (localVariables) => { export async function getRenderContent(templateEngine, content, variables, localVariables, defaultParse) { if (content && templateEngine === 'handlebars') { try { - try { - await replaceVariableValue(content, variables, localVariables); - } catch (error) { - return null; - } const renderedContent = Handlebars.compile(content); // 处理渲染后的内容 const data = getVariablesData(localVariables); - const html = renderedContent({ ...variables.ctxRef.current, ...data }); + const { $nDate } = variables.ctxRef.current; + const variableDate = {}; + Object.keys($nDate).map((v) => { + variableDate[v] = $nDate[v](); + }); + const html = renderedContent({ ...variables.ctxRef.current, ...data, $nDate: variableDate }); return await defaultParse(html); } catch (error) { console.log(error);