Просмотр исходного кода

fix functional components that return string or nothing (fix #3919)

Evan You 9 лет назад
Родитель
Сommit
ceab0b71d0
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/core/vdom/create-component.js

+ 5 - 3
src/core/vdom/create-component.js

@@ -113,9 +113,11 @@ function createFunctionalComponent (
       slots: () => resolveSlots(children, context)
     }
   )
-  vnode.functionalContext = context
-  if (data.slot) {
-    (vnode.data || (vnode.data = {})).slot = data.slot
+  if (vnode instanceof VNode) {
+    vnode.functionalContext = context
+    if (data.slot) {
+      (vnode.data || (vnode.data = {})).slot = data.slot
+    }
   }
   return vnode
 }