Home / Function/ initRender() — vue Function Reference

initRender() — vue Function Reference

Architecture documentation for the initRender() function in render.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  fa879678_0767_c9f5_f3e2_55c3620ec148["initRender()"]
  ad112c37_faea_8798_03f1_18e1a6303f0d["initMixin()"]
  ad112c37_faea_8798_03f1_18e1a6303f0d -->|calls| fa879678_0767_c9f5_f3e2_55c3620ec148
  d8821cb4_3136_e465_ecc1_56f86574ae34["resolveSlots()"]
  fa879678_0767_c9f5_f3e2_55c3620ec148 -->|calls| d8821cb4_3136_e465_ecc1_56f86574ae34
  ad2344e6_3a5b_8f6e_1810_1802147c80c8["normalizeScopedSlots()"]
  fa879678_0767_c9f5_f3e2_55c3620ec148 -->|calls| ad2344e6_3a5b_8f6e_1810_1802147c80c8
  642a6516_0239_a923_4b9f_35cbc2fdb666["createElement()"]
  fa879678_0767_c9f5_f3e2_55c3620ec148 -->|calls| 642a6516_0239_a923_4b9f_35cbc2fdb666
  style fa879678_0767_c9f5_f3e2_55c3620ec148 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/instance/render.ts lines 21–86

export function initRender(vm: Component) {
  vm._vnode = null // the root of the child tree
  vm._staticTrees = null // v-once cached trees
  const options = vm.$options
  const parentVnode = (vm.$vnode = options._parentVnode!) // the placeholder node in parent tree
  const renderContext = parentVnode && (parentVnode.context as Component)
  vm.$slots = resolveSlots(options._renderChildren, renderContext)
  vm.$scopedSlots = parentVnode
    ? normalizeScopedSlots(
        vm.$parent!,
        parentVnode.data!.scopedSlots,
        vm.$slots
      )
    : emptyObject
  // bind the createElement fn to this instance
  // so that we get proper render context inside it.
  // args order: tag, data, children, normalizationType, alwaysNormalize
  // internal version is used by render functions compiled from templates
  // @ts-expect-error
  vm._c = (a, b, c, d) => createElement(vm, a, b, c, d, false)
  // normalization is always applied for the public version, used in
  // user-written render functions.
  // @ts-expect-error
  vm.$createElement = (a, b, c, d) => createElement(vm, a, b, c, d, true)

  // $attrs & $listeners are exposed for easier HOC creation.
  // they need to be reactive so that HOCs using them are always updated
  const parentData = parentVnode && parentVnode.data

  /* istanbul ignore else */
  if (__DEV__) {
    defineReactive(
      vm,
      '$attrs',
      (parentData && parentData.attrs) || emptyObject,
      () => {
        !isUpdatingChildComponent && warn(`$attrs is readonly.`, vm)
      },
      true
    )
    defineReactive(
      vm,
      '$listeners',
      options._parentListeners || emptyObject,
      () => {
        !isUpdatingChildComponent && warn(`$listeners is readonly.`, vm)
      },
      true
    )
  } else {
    defineReactive(
      vm,
      '$attrs',
      (parentData && parentData.attrs) || emptyObject,
      null,
      true
    )
    defineReactive(
      vm,
      '$listeners',
      options._parentListeners || emptyObject,
      null,
      true
    )
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does initRender() do?
initRender() is a function in the vue codebase.
What does initRender() call?
initRender() calls 3 function(s): createElement, normalizeScopedSlots, resolveSlots.
What calls initRender()?
initRender() is called by 1 function(s): initMixin.

Analyze Your Own Codebase

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

Try Supermodel Free