Skip to content

Commit

Permalink
fix(transformer): 在 if 语句中生成 props.manger 语句错误
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed May 22, 2019
1 parent ff300db commit 1caf405
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/taro-transformer-wx/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ export function setAncestorCondition (jsx: NodePath<t.Node>, expr: t.Expression)
}
} else if (t.isJSXExpressionContainer(attr.value)) {
const condition = cloneDeep(attr.value.expression)
expr = t.logicalExpression('&&', setAncestorCondition(logicalJSX, condition), expr)
const ifStem = logicalJSX.findParent(p => p.isIfStatement())
expr = t.logicalExpression('&&', setAncestorCondition(logicalJSX, ifStem && ifStem.isIfStatement() ? attr.value.expression : condition), expr)
}
}
}
Expand Down

0 comments on commit 1caf405

Please sign in to comment.