Home / Function/ FunctionalRenderContext() — vue Function Reference

FunctionalRenderContext() — vue Function Reference

Architecture documentation for the FunctionalRenderContext() function in create-functional-component.ts from the vue codebase.

Function typescript VueCore Instance calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  2b1a34a9_e713_84e7_6b26_d06155dba96c["FunctionalRenderContext()"]
  414b37af_5f63_dee7_31a2_9a7cad5979ec["create-functional-component.ts"]
  2b1a34a9_e713_84e7_6b26_d06155dba96c -->|defined in| 414b37af_5f63_dee7_31a2_9a7cad5979ec
  8e06d47c_8725_0580_db2e_8b6ce77e9953["createFunctionalComponent()"]
  8e06d47c_8725_0580_db2e_8b6ce77e9953 -->|calls| 2b1a34a9_e713_84e7_6b26_d06155dba96c
  ee505869_7e2d_eb58_154d_d7a4647b89dd["resolveInject()"]
  2b1a34a9_e713_84e7_6b26_d06155dba96c -->|calls| ee505869_7e2d_eb58_154d_d7a4647b89dd
  e490d83e_fe82_d38d_a362_5157771a3160["normalizeScopedSlots()"]
  2b1a34a9_e713_84e7_6b26_d06155dba96c -->|calls| e490d83e_fe82_d38d_a362_5157771a3160
  104d091a_5520_5f91_df65_4a79135c9791["resolveSlots()"]
  2b1a34a9_e713_84e7_6b26_d06155dba96c -->|calls| 104d091a_5520_5f91_df65_4a79135c9791
  02c4c5f0_14bc_07b8_fddc_e3511462f997["createElement()"]
  2b1a34a9_e713_84e7_6b26_d06155dba96c -->|calls| 02c4c5f0_14bc_07b8_fddc_e3511462f997
  style 2b1a34a9_e713_84e7_6b26_d06155dba96c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/vdom/create-functional-component.ts lines 21–96

export function FunctionalRenderContext(
  data: VNodeData,
  props: Object,
  children: Array<VNode> | undefined,
  parent: Component,
  Ctor: typeof Component
) {
  const options = Ctor.options
  // ensure the createElement function in functional components
  // gets a unique context - this is necessary for correct named slot check
  let contextVm
  if (hasOwn(parent, '_uid')) {
    contextVm = Object.create(parent)
    contextVm._original = parent
  } else {
    // the context vm passed in is a functional context as well.
    // in this case we want to make sure we are able to get a hold to the
    // real context instance.
    contextVm = parent
    // @ts-ignore
    parent = parent._original
  }
  const isCompiled = isTrue(options._compiled)
  const needNormalization = !isCompiled

  this.data = data
  this.props = props
  this.children = children
  this.parent = parent
  this.listeners = data.on || emptyObject
  this.injections = resolveInject(options.inject, parent)
  this.slots = () => {
    if (!this.$slots) {
      normalizeScopedSlots(
        parent,
        data.scopedSlots,
        (this.$slots = resolveSlots(children, parent))
      )
    }
    return this.$slots
  }

  Object.defineProperty(this, 'scopedSlots', {
    enumerable: true,
    get() {
      return normalizeScopedSlots(parent, data.scopedSlots, this.slots())
    }
  } as any)

  // support for compiled functional template
  if (isCompiled) {
    // exposing $options for renderStatic()
    this.$options = options
    // pre-resolve slots for renderSlot()
    this.$slots = this.slots()
    this.$scopedSlots = normalizeScopedSlots(
      parent,
      data.scopedSlots,
      this.$slots
    )
  }

  if (options._scopeId) {
    this._c = (a, b, c, d) => {
      const vnode = createElement(contextVm, a, b, c, d, needNormalization)
      if (vnode && !isArray(vnode)) {
        vnode.fnScopeId = options._scopeId
        vnode.fnContext = parent
      }
      return vnode
    }
  } else {
    this._c = (a, b, c, d) =>
      createElement(contextVm, a, b, c, d, needNormalization)
  }
}

Domain

Subdomains

Frequently Asked Questions

What does FunctionalRenderContext() do?
FunctionalRenderContext() is a function in the vue codebase, defined in src/core/vdom/create-functional-component.ts.
Where is FunctionalRenderContext() defined?
FunctionalRenderContext() is defined in src/core/vdom/create-functional-component.ts at line 21.
What does FunctionalRenderContext() call?
FunctionalRenderContext() calls 4 function(s): createElement, normalizeScopedSlots, resolveInject, resolveSlots.
What calls FunctionalRenderContext()?
FunctionalRenderContext() is called by 1 function(s): createFunctionalComponent.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free