Home / Function/ renderSlot() — vue Function Reference

renderSlot() — vue Function Reference

Architecture documentation for the renderSlot() function in render-slot.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  7c0b2c9b_8b50_d80c_d1aa_f3dd25495abb["renderSlot()"]
  981bd2a9_e269_1bf2_0982_c85b6a583247["render-slot.ts"]
  7c0b2c9b_8b50_d80c_d1aa_f3dd25495abb -->|defined in| 981bd2a9_e269_1bf2_0982_c85b6a583247
  style 7c0b2c9b_8b50_d80c_d1aa_f3dd25495abb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/instance/render-helpers/render-slot.ts lines 7–39

export function renderSlot(
  name: string,
  fallbackRender: ((() => Array<VNode>) | Array<VNode>) | null,
  props: Record<string, any> | null,
  bindObject: object | null
): Array<VNode> | null {
  const scopedSlotFn = this.$scopedSlots[name]
  let nodes
  if (scopedSlotFn) {
    // scoped slot
    props = props || {}
    if (bindObject) {
      if (__DEV__ && !isObject(bindObject)) {
        warn('slot v-bind without argument expects an Object', this)
      }
      props = extend(extend({}, bindObject), props)
    }
    nodes =
      scopedSlotFn(props) ||
      (isFunction(fallbackRender) ? fallbackRender() : fallbackRender)
  } else {
    nodes =
      this.$slots[name] ||
      (isFunction(fallbackRender) ? fallbackRender() : fallbackRender)
  }

  const target = props && props.slot
  if (target) {
    return this.$createElement('template', { slot: target }, nodes)
  } else {
    return nodes
  }
}

Domain

Subdomains

Frequently Asked Questions

What does renderSlot() do?
renderSlot() is a function in the vue codebase, defined in src/core/instance/render-helpers/render-slot.ts.
Where is renderSlot() defined?
renderSlot() is defined in src/core/instance/render-helpers/render-slot.ts at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free