Skip to content

Commit

Permalink
fix(tranformer-wx): taroize 转换后的组件不支持 对象 style
Browse files Browse the repository at this point in the history
fix #7305
  • Loading branch information
ivan-94 committed Aug 12, 2020
1 parent e4d5b9c commit fbbc9eb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/taro-transformer-wx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,7 @@ export default function transform (options: TransformOptions): TransformResult {

const expr = value.expression as any
const exprPath = path.get('value.expression')
const classDecl = path.findParent(p => p.isClassDeclaration())
const classDeclName = classDecl && classDecl.isClassDeclaration() && safeGet(classDecl, 'node.id.name', '')
let isConverted = false
if (classDeclName) {
isConverted = classDeclName === '_C' || classDeclName.endsWith('Tmpl')
}
if (!t.isBinaryExpression(expr, { operator: '+' }) && !t.isLiteral(expr) && name.name === 'style' && !isConverted) {
if (!t.isBinaryExpression(expr, { operator: '+' }) && !t.isLiteral(expr) && name.name === 'style') {
const jsxID = path.findParent(p => p.isJSXOpeningElement()).get('name')
if (jsxID && jsxID.isJSXIdentifier() && DEFAULT_Component_SET.has(jsxID.node.name)) {
exprPath.replaceWith(
Expand Down

0 comments on commit fbbc9eb

Please sign in to comment.