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
  0a749d1e_6938_0129_df18_2729a9261391["renderSlot()"]
  a5e4f9a1_4fe6_c197_b523_7b0785a84bcf["render-slot.ts"]
  0a749d1e_6938_0129_df18_2729a9261391 -->|defined in| a5e4f9a1_4fe6_c197_b523_7b0785a84bcf
  style 0a749d1e_6938_0129_df18_2729a9261391 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