From b5bee56f28b99a7a66d0e1b6cb4e0c622ef30503 Mon Sep 17 00:00:00 2001 From: yuche Date: Thu, 31 Jan 2019 17:06:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(transformer):=20=E7=9B=B4=E6=8E=A5=E5=86=99?= =?UTF-8?q?=20JSX=20=E5=BE=AA=E7=8E=AF=E5=9C=A8=E4=B8=89=E5=85=83=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E5=BE=AA=E7=8E=AF=E4=B8=AD=E4=BC=9A=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=8C=BF=E5=90=8D=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-transformer-wx/src/render.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/taro-transformer-wx/src/render.ts b/packages/taro-transformer-wx/src/render.ts index 0bafee50ca90..d80f05a0a35e 100644 --- a/packages/taro-transformer-wx/src/render.ts +++ b/packages/taro-transformer-wx/src/render.ts @@ -283,11 +283,11 @@ export class RenderParser { ) setTemplate(name, jsxElementPath, this.templates) } - } else if (t.isJSXElement(consequent) && t.isCallExpression(alternate)) { + } else if (t.isJSXElement(consequent) && t.isCallExpression(alternate) && !isArrayMapCallExpression(parentPath.get('alternate'))) { const id = generateAnonymousState(this.renderScope!, parentPath.get('alternate') as any, this.referencedIdentifiers, true) parentPath.get('alternate').replaceWith(id) // - } else if (t.isJSXElement(alternate) && t.isCallExpression(consequent)) { + } else if (t.isJSXElement(alternate) && t.isCallExpression(consequent) && !isArrayMapCallExpression(parentPath.get('consequent'))) { const id = generateAnonymousState(this.renderScope!, parentPath.get('consequent') as any, this.referencedIdentifiers, true) parentPath.get('consequent').replaceWith(id) } else {