Skip to content

Commit

Permalink
feat(taroize): 事件名需要加 this
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche authored and luckyadam committed Nov 19, 2018
1 parent a656632 commit 0dadefa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/taroize/src/wxml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@ function parseAttribute (attr: Attribute) {
}

const jsxKey = handleAttrKey(key)
if (/^on[A-Z]/.test(jsxKey) && jsxValue && t.isStringLiteral(jsxValue)) {
jsxValue = t.jSXExpressionContainer(
t.memberExpression(
t.thisExpression(),
t.identifier(jsxValue.value)
)
)
}
return t.jSXAttribute(t.jSXIdentifier(jsxKey), jsxValue)
}

Expand Down

0 comments on commit 0dadefa

Please sign in to comment.