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

perf: cache result from functional ctx.slots() calls

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

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

@@ -49,7 +49,7 @@ export function FunctionalRenderContext (
   this.parent = parent
   this.parent = parent
   this.listeners = data.on || emptyObject
   this.listeners = data.on || emptyObject
   this.injections = resolveInject(options.inject, parent)
   this.injections = resolveInject(options.inject, parent)
-  this.slots = () => resolveSlots(children, parent)
+  this.slots = () => this.$slots || (this.$slots = resolveSlots(children, parent))
 
 
   Object.defineProperty(this, 'scopedSlots', ({
   Object.defineProperty(this, 'scopedSlots', ({
     enumerable: true,
     enumerable: true,