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
  1320adb5_5107_07f8_1ce0_f5863182564d["default.render()"]
  b0a7d15f_5bac_dc6f_49fa_0554a1565637["transition.ts"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|defined in| b0a7d15f_5bac_dc6f_49fa_0554a1565637
  32929870_b75b_41a6_92b1_1b9583cd6fa4["hasParentTransition()"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|calls| 32929870_b75b_41a6_92b1_1b9583cd6fa4
  f0bea8c2_0795_9f08_1d83_aa041806c9d8["getRealChild()"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|calls| f0bea8c2_0795_9f08_1d83_aa041806c9d8
  652bcca8_21aa_d77f_4455_14e49dce43e3["placeholder()"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|calls| 652bcca8_21aa_d77f_4455_14e49dce43e3
  b540b163_1630_f661_69e2_d6cd1c278184["extractTransitionData()"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|calls| b540b163_1630_f661_69e2_d6cd1c278184
  2a24ffbd_ea44_e98c_52cc_b541de95fb7d["isSameChild()"]
  1320adb5_5107_07f8_1ce0_f5863182564d -->|calls| 2a24ffbd_ea44_e98c_52cc_b541de95fb7d
  style 1320adb5_5107_07f8_1ce0_f5863182564d 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

Domain

Subdomains

Frequently Asked Questions

What does default.render() do?
default.render() is a function in the vue codebase, defined in src/platforms/web/runtime/components/transition.ts.
Where is default.render() defined?
default.render() is defined in src/platforms/web/runtime/components/transition.ts at line 89.
What does default.render() call?
default.render() calls 5 function(s): extractTransitionData, getRealChild, hasParentTransition, isSameChild, placeholder.

Analyze Your Own Codebase

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

Try Supermodel Free