From fec71f5089ba7b187c5caa6cae462c8b55c92273 Mon Sep 17 00:00:00 2001 From: luckyadam <weitaozsh@gmail.com> Date: Fri, 7 Dec 2018 18:14:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(tarize):=20=E9=92=88=E5=AF=B9=20template=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20options=20=E6=94=B9=E4=B8=BA=20static=20op?= =?UTF-8?q?tions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taroize/src/template.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/taroize/src/template.ts b/packages/taroize/src/template.ts index a32ab5061238..b2172ecd1668 100644 --- a/packages/taroize/src/template.ts +++ b/packages/taroize/src/template.ts @@ -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()