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
  72e47df1_f475_b052_b735_29fdce7cc0ac["default.render()"]
  4092d37a_e401_1398_7538_ace18f6c50d5["transition.ts"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|defined in| 4092d37a_e401_1398_7538_ace18f6c50d5
  0ea56a75_91b5_6d73_ddcf_475a4f2919a1["hasParentTransition()"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|calls| 0ea56a75_91b5_6d73_ddcf_475a4f2919a1
  96db6e05_87aa_8b96_0344_10d5a8e15e47["getRealChild()"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|calls| 96db6e05_87aa_8b96_0344_10d5a8e15e47
  b208fdde_1e9d_95bf_5b2e_5dd4fdbb992f["placeholder()"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|calls| b208fdde_1e9d_95bf_5b2e_5dd4fdbb992f
  085b3402_189f_178a_c080_76b4cbb47ee4["extractTransitionData()"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|calls| 085b3402_189f_178a_c080_76b4cbb47ee4
  8e80c8cb_066a_a59c_2264_0579c65bc1e3["isSameChild()"]
  72e47df1_f475_b052_b735_29fdce7cc0ac -->|calls| 8e80c8cb_066a_a59c_2264_0579c65bc1e3
  style 72e47df1_f475_b052_b735_29fdce7cc0ac 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