Skip to content

Commit

Permalink
fix(taroize): 生命周期函数使用普通类函数,close #3793
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Jul 12, 2019
1 parent 5f18760 commit eb7931c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/taroize/src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,12 @@ function parsePage (
return cm
}
const node = value.node
const method = t.isFunctionExpression(node) || t.isArrowFunctionExpression(node)
? t.classProperty(t.identifier(lifecycle), t.arrowFunctionExpression(params, node.body, isAsync))
: t.classProperty(t.identifier(lifecycle), node)
return method
if (t.isFunctionExpression(node) || t.isArrowFunctionExpression(node)) {
const method = t.classMethod('method', t.identifier(lifecycle), params, t.isBlockStatement(node.body) ? node.body : t.blockStatement([t.returnStatement(node.body)]))
method.async = isAsync
return method
}
return t.classProperty(t.identifier(lifecycle), node)
}
let hasArguments = false
prop.traverse({
Expand Down

0 comments on commit eb7931c

Please sign in to comment.