Skip to content

Commit

Permalink
fix(tarize): 针对 template 增加 options 改为 static options
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Dec 7, 2018
1 parent a33290e commit fec71f5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/taroize/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ export function parseTemplate (path: NodePath<t.JSXElement>, dirPath: string) {
// 使用 ...spread
render = buildRender(block, [], Array.from(refIds), [])
}

const classProp = t.classProperty(t.identifier('options'), t.objectExpression([
t.objectProperty(
t.identifier('addGlobalClass'),
t.booleanLiteral(true)
)
])) as any
classProp.static = true
const classDecl = t.classDeclaration(
t.identifier(className),
t.memberExpression(t.identifier('Taro'), t.identifier('Component')),
t.classBody([render!, t.classProperty(t.identifier('options'), t.objectExpression([
t.objectProperty(
t.identifier('addGlobalClass'),
t.booleanLiteral(true)
)
]))]),
t.classBody([render!, classProp]),
[]
)
path.remove()
Expand Down

0 comments on commit fec71f5

Please sign in to comment.