Skip to content

Commit

Permalink
fix(transformer): 单独使用的自定义也加入 key
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Jul 4, 2018
1 parent ef99f65 commit a231a90
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/taro-transformer-wx/src/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,20 @@ class Transformer {
t.identifier('$$' + name)
)
)
setJSXAttr(
jsx,
'wx:for',
t.jSXExpressionContainer(
t.identifier('$$' + name)
)
)
setJSXAttr(
jsx,
'wx:key',
t.jSXExpressionContainer(
t.numericLiteral(Math.floor(Math.random() * 1e8))
)
)
path.replaceWith(jsx)
this.customComponentNames.add('$$' + name)
})
Expand Down

0 comments on commit a231a90

Please sign in to comment.