Home / Function/ initRender() — vue Function Reference

initRender() — vue Function Reference

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

Function typescript VueCore Instance calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f["initRender()"]
  2c65c43e_4691_415f_689a_805ec38ae46c["render.ts"]
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f -->|defined in| 2c65c43e_4691_415f_689a_805ec38ae46c
  27e71f35_12fd_58cc_25d7_c5686da5aaf6["initMixin()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| bdbcb4df_444f_38c6_ba9d_20ef23f9091f
  104d091a_5520_5f91_df65_4a79135c9791["resolveSlots()"]
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f -->|calls| 104d091a_5520_5f91_df65_4a79135c9791
  e490d83e_fe82_d38d_a362_5157771a3160["normalizeScopedSlots()"]
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f -->|calls| e490d83e_fe82_d38d_a362_5157771a3160
  02c4c5f0_14bc_07b8_fddc_e3511462f997["createElement()"]
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f -->|calls| 02c4c5f0_14bc_07b8_fddc_e3511462f997
  style bdbcb4df_444f_38c6_ba9d_20ef23f9091f 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, defined in src/core/instance/render.ts.
Where is initRender() defined?
initRender() is defined in src/core/instance/render.ts at line 21.
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