Home / Function/ default.render() — vue Function Reference

default.render() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32["default.render()"]
  7ffb1354_3020_4766_4ba6_41f70ebff4ea["hasParentTransition()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 7ffb1354_3020_4766_4ba6_41f70ebff4ea
  01730846_7c40_b108_ac7b_306564cbdd8a["getRealChild()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 01730846_7c40_b108_ac7b_306564cbdd8a
  323b60df_4a40_eb22_c98d_eb0d61cfecb6["placeholder()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 323b60df_4a40_eb22_c98d_eb0d61cfecb6
  587d6539_745c_96b2_3b45_56fbf8ca59e2["isPrimitive()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 587d6539_745c_96b2_3b45_56fbf8ca59e2
  1b7a090e_3310_f52f_ba36_fa6fc82b4a31["extractTransitionData()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 1b7a090e_3310_f52f_ba36_fa6fc82b4a31
  16598f0d_3c12_241e_970f_279f73d7a869["isSameChild()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 16598f0d_3c12_241e_970f_279f73d7a869
  133969d0_a7bd_f1c5_46a3_9fb8fd249583["extend()"]
  a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 -->|calls| 133969d0_a7bd_f1c5_46a3_9fb8fd249583
  style a0548f3d_ad52_9c9a_fe0e_c4bc5ed97f32 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/platforms/web/runtime/components/transition.ts lines 89–204

  render(h: Function) {
    let children: any = this.$slots.default
    if (!children) {
      return
    }

    // filter out text nodes (possible whitespaces)
    children = children.filter(isNotTextNode)
    /* istanbul ignore if */
    if (!children.length) {
      return
    }

    // warn multiple elements
    if (__DEV__ && children.length > 1) {
      warn(
        '<transition> can only be used on a single element. Use ' +
          '<transition-group> for lists.',
        this.$parent
      )
    }

    const mode: string = this.mode

    // warn invalid mode
    if (__DEV__ && mode && mode !== 'in-out' && mode !== 'out-in') {
      warn('invalid <transition> mode: ' + mode, this.$parent)
    }

    const rawChild: VNode = children[0]

    // if this is a component root node and the component's
    // parent container node also has transition, skip.
    if (hasParentTransition(this.$vnode)) {
      return rawChild
    }

    // apply transition data to child
    // use getRealChild() to ignore abstract components e.g. keep-alive
    const child = getRealChild(rawChild)
    /* istanbul ignore if */
    if (!child) {
      return rawChild
    }

    if (this._leaving) {
      return placeholder(h, rawChild)
    }

    // ensure a key that is unique to the vnode type and to this transition
    // component instance. This key will be used to remove pending leaving nodes
    // during entering.
    const id: string = `__transition-${this._uid}-`
    child.key =
      child.key == null
        ? child.isComment
          ? id + 'comment'
          : id + child.tag
        : isPrimitive(child.key)
        ? String(child.key).indexOf(id) === 0
          ? child.key
          : id + child.key
        : child.key

    const data: Object = ((child.data || (child.data = {})).transition =
      extractTransitionData(this))
    const oldRawChild: VNode = this._vnode
    const oldChild = getRealChild(oldRawChild)

    // mark v-show
    // so that the transition module can hand over the control to the directive
    if (child.data.directives && child.data.directives.some(isVShowDirective)) {
      child.data.show = true
    }

    if (
      oldChild &&
      oldChild.data &&
      !isSameChild(child, oldChild) &&
      !isAsyncPlaceholder(oldChild) &&
      // #6687 component root is a comment node
      !(
        oldChild.componentInstance &&
        oldChild.componentInstance._vnode!.isComment
      )
    ) {
      // replace old child transition data with fresh one
      // important for dynamic transitions!
      const oldData: Object = (oldChild.data.transition = extend({}, data))
      // handle transition mode
      if (mode === 'out-in') {
        // return placeholder node and queue update when leave finishes
        this._leaving = true
        mergeVNodeHook(oldData, 'afterLeave', () => {
          this._leaving = false
          this.$forceUpdate()
        })
        return placeholder(h, rawChild)
      } else if (mode === 'in-out') {
        if (isAsyncPlaceholder(child)) {
          return oldRawChild
        }
        let delayedLeave
        const performLeave = () => {
          delayedLeave()
        }
        mergeVNodeHook(data, 'afterEnter', performLeave)
        mergeVNodeHook(data, 'enterCancelled', performLeave)
        mergeVNodeHook(oldData, 'delayLeave', leave => {
          delayedLeave = leave
        })
      }
    }

    return rawChild
  }

Domain

Subdomains

Frequently Asked Questions

What does default.render() do?
default.render() is a function in the vue codebase.
What does default.render() call?
default.render() calls 7 function(s): extend, extractTransitionData, getRealChild, hasParentTransition, isPrimitive, isSameChild, placeholder.

Analyze Your Own Codebase

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

Try Supermodel Free