Skip to content

Commit

Permalink
fix(transformer): 直接写 JSX 循环在三元表达式循环中会生成匿名表达式
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Jan 31, 2019
1 parent 65f786c commit b5bee56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/taro-transformer-wx/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b5bee56

Please sign in to comment.