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 CoreRuntime Instance calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  c5286b65_3542_0b12_cbd4_8f0583f72f9a["FunctionalRenderContext()"]
  dfa00dc1_b5e1_fc4b_364c_221e22660e03["create-functional-component.ts"]
  c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|defined in| dfa00dc1_b5e1_fc4b_364c_221e22660e03
  b0612485_d1af_0118_4a95_5689631b7d51["createFunctionalComponent()"]
  b0612485_d1af_0118_4a95_5689631b7d51 -->|calls| c5286b65_3542_0b12_cbd4_8f0583f72f9a
  38a042a8_e008_9381_562a_4c9fe664057e["resolveInject()"]
  c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|calls| 38a042a8_e008_9381_562a_4c9fe664057e
  1e1e5127_e2df_8612_b7e7_d738cde5407a["normalizeScopedSlots()"]
  c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|calls| 1e1e5127_e2df_8612_b7e7_d738cde5407a
  23d9ce46_8163_f008_2464_0fc0040f465c["resolveSlots()"]
  c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|calls| 23d9ce46_8163_f008_2464_0fc0040f465c
  2c55eb58_ce03_1c5e_ac99_4fc1ef41c3cd["createElement()"]
  c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|calls| 2c55eb58_ce03_1c5e_ac99_4fc1ef41c3cd
  style c5286b65_3542_0b12_cbd4_8f0583f72f9a 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