Skip to content

Commit

Permalink
fix(transformer): 使用挂载在 this 下的变量渲染可能会报错
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Oct 23, 2018
1 parent f0facec commit 9e66495
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/taro-transformer-wx/src/render.ts
Expand Up @@ -1331,7 +1331,7 @@ export class RenderParser {
this.renderPath.node.body.body.unshift(
template(`this.__state = arguments[0] || this.state || {};`)(),
template(`this.__props = arguments[1] || this.props || {};`)(),
t.variableDeclaration(
this.usedThisProperties.size ? t.variableDeclaration(
'const',
[
t.variableDeclarator(
Expand All @@ -1342,7 +1342,7 @@ export class RenderParser {
t.thisExpression()
)
]
)
) : t.emptyStatement()
)

if (t.isIdentifier(this.renderPath.node.key)) {
Expand Down

0 comments on commit 9e66495

Please sign in to comment.