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
  14dd3d9c_2894_3049_ac41_2970261c2033["default.render()"]
  1a29b4a6_5be5_c847_698d_1690b931b8f8["hasParentTransition()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 1a29b4a6_5be5_c847_698d_1690b931b8f8
  2ca4115c_d03a_76ae_e09f_28ed9bf97389["getRealChild()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 2ca4115c_d03a_76ae_e09f_28ed9bf97389
  7b3bd2f8_0e93_8d20_f0d1_3417b014f6fc["placeholder()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 7b3bd2f8_0e93_8d20_f0d1_3417b014f6fc
  7ce22b46_ffa0_d052_2b70_6ef17b86c493["isPrimitive()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 7ce22b46_ffa0_d052_2b70_6ef17b86c493
  d64b73be_0bd0_cf9f_0a1a_986b6e6f9b5b["extractTransitionData()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| d64b73be_0bd0_cf9f_0a1a_986b6e6f9b5b
  8683024d_6fe4_f749_6198_e202034ab543["isSameChild()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 8683024d_6fe4_f749_6198_e202034ab543
  7a0093e3_a58a_af71_971f_488b65897e74["extend()"]
  14dd3d9c_2894_3049_ac41_2970261c2033 -->|calls| 7a0093e3_a58a_af71_971f_488b65897e74
  style 14dd3d9c_2894_3049_ac41_2970261c2033 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