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.

Entity Profile

Dependency Diagram

graph TD
  2a3d2c68_f002_d816_7b35_bdbc95f4434c["FunctionalRenderContext()"]
  d79e8d83_cfdc_ef26_76af_cc7f688eafce["createFunctionalComponent()"]
  d79e8d83_cfdc_ef26_76af_cc7f688eafce -->|calls| 2a3d2c68_f002_d816_7b35_bdbc95f4434c
  ad8ba0ef_7fa6_8283_6f50_d72913808144["resolveInject()"]
  2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| ad8ba0ef_7fa6_8283_6f50_d72913808144
  ad2344e6_3a5b_8f6e_1810_1802147c80c8["normalizeScopedSlots()"]
  2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| ad2344e6_3a5b_8f6e_1810_1802147c80c8
  d8821cb4_3136_e465_ecc1_56f86574ae34["resolveSlots()"]
  2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| d8821cb4_3136_e465_ecc1_56f86574ae34
  642a6516_0239_a923_4b9f_35cbc2fdb666["createElement()"]
  2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| 642a6516_0239_a923_4b9f_35cbc2fdb666
  style 2a3d2c68_f002_d816_7b35_bdbc95f4434c 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.
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