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

default.render() — vue Function Reference

Architecture documentation for the default.render() function in keep-alive.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  1bd7b41e_bed6_4a08_d909_d52653fb679b["default.render()"]
  df063946_7158_b993_ea79_ae2622374b9a["keep-alive.ts"]
  1bd7b41e_bed6_4a08_d909_d52653fb679b -->|defined in| df063946_7158_b993_ea79_ae2622374b9a
  d9f21a25_b5cd_1bf6_b4c8_d37fee1ff3b2["_getComponentName()"]
  1bd7b41e_bed6_4a08_d909_d52653fb679b -->|calls| d9f21a25_b5cd_1bf6_b4c8_d37fee1ff3b2
  0b551bb7_a819_169d_c90c_6998a28bd742["matches()"]
  1bd7b41e_bed6_4a08_d909_d52653fb679b -->|calls| 0b551bb7_a819_169d_c90c_6998a28bd742
  style 1bd7b41e_bed6_4a08_d909_d52653fb679b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/components/keep-alive.ts lines 130–170

  render() {
    const slot = this.$slots.default
    const vnode = getFirstComponentChild(slot)
    const componentOptions = vnode && vnode.componentOptions
    if (componentOptions) {
      // check pattern
      const name = _getComponentName(componentOptions)
      const { include, exclude } = this
      if (
        // not included
        (include && (!name || !matches(include, name))) ||
        // excluded
        (exclude && name && matches(exclude, name))
      ) {
        return vnode
      }

      const { cache, keys } = this
      const key =
        vnode.key == null
          ? // same constructor may get registered as different local components
            // so cid alone is not enough (#3269)
            componentOptions.Ctor.cid +
            (componentOptions.tag ? `::${componentOptions.tag}` : '')
          : vnode.key
      if (cache[key]) {
        vnode.componentInstance = cache[key].componentInstance
        // make current key freshest
        remove(keys, key)
        keys.push(key)
      } else {
        // delay setting the cache until update
        this.vnodeToCache = vnode
        this.keyToCache = key
      }

      // @ts-expect-error can vnode.data can be undefined
      vnode.data.keepAlive = true
    }
    return vnode || (slot && slot[0])
  }

Domain

Subdomains

Frequently Asked Questions

What does default.render() do?
default.render() is a function in the vue codebase, defined in src/core/components/keep-alive.ts.
Where is default.render() defined?
default.render() is defined in src/core/components/keep-alive.ts at line 130.
What does default.render() call?
default.render() calls 2 function(s): _getComponentName, matches.

Analyze Your Own Codebase

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

Try Supermodel Free