Evan You 9 лет назад
Родитель
Сommit
2d58d0e3d7

+ 4 - 8
src/compiler/codegen/index.js

@@ -210,14 +210,10 @@ function genDirectives (el: ASTElement): string | void {
   }
 }
 
-function genChildren (el: ASTElement, asThunk?: boolean): string | void {
-  if (!el.children.length) {
-    return
+function genChildren (el: ASTElement): string | void {
+  if (el.children.length) {
+    return '[' + el.children.map(genNode).join(',') + ']'
   }
-  const code = '[' + el.children.map(genNode).join(',') + ']'
-  return asThunk
-    ? `function(){return ${code}}`
-    : code
 }
 
 function genNode (node: ASTNode) {
@@ -243,7 +239,7 @@ function genSlot (el: ASTElement): string {
 }
 
 function genComponent (el: ASTElement): string {
-  const children = genChildren(el, true)
+  const children = genChildren(el)
   return `_h(${el.component},${genData(el)}${
     children ? `,${children}` : ''
   })`

+ 1 - 1
src/core/vdom/create-component.js

@@ -69,8 +69,8 @@ export function createComponent (
       context.$createElement,
       {
         props,
-        parent: context,
         data,
+        parent: context,
         children: normalizeChildren(children),
         slots: () => resolveSlots(children)
       }

+ 1 - 1
test/unit/features/transition/transition.spec.js

@@ -151,7 +151,7 @@ if (!isIE9) {
                 enter,
                 leave
               }
-            }, () => [this.ok ? h('div', { class: 'test' }, 'foo') : undefined])
+            }, this.ok ? [h('div', { class: 'test' }, 'foo')] : undefined)
           ])
         },
         data: { ok: true }