Home / File/ render-slot.ts — vue Source File

render-slot.ts — vue Source File

Architecture documentation for render-slot.ts, a typescript file in the vue codebase. 2 imports, 1 dependents.

File typescript CoreRuntime Instance 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  a5e4f9a1_4fe6_c197_b523_7b0785a84bcf["render-slot.ts"]
  02e43f4a_da65_7acd_5a98_0f017554a159["index"]
  a5e4f9a1_4fe6_c197_b523_7b0785a84bcf --> 02e43f4a_da65_7acd_5a98_0f017554a159
  f6868225_acf7_afdc_ebd3_15704ddb6566["vnode"]
  a5e4f9a1_4fe6_c197_b523_7b0785a84bcf --> f6868225_acf7_afdc_ebd3_15704ddb6566
  8456d994_c5db_04c1_7466_74c5274c4133["index.ts"]
  8456d994_c5db_04c1_7466_74c5274c4133 --> a5e4f9a1_4fe6_c197_b523_7b0785a84bcf
  style a5e4f9a1_4fe6_c197_b523_7b0785a84bcf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { extend, warn, isObject, isFunction } from 'core/util/index'
import VNode from 'core/vdom/vnode'

/**
 * Runtime helper for rendering <slot>
 */
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

Functions

Dependencies

  • index
  • vnode

Frequently Asked Questions

What does render-slot.ts do?
render-slot.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Instance subdomain.
What functions are defined in render-slot.ts?
render-slot.ts defines 1 function(s): renderSlot.
What does render-slot.ts depend on?
render-slot.ts imports 2 module(s): index, vnode.
What files import render-slot.ts?
render-slot.ts is imported by 1 file(s): index.ts.
Where is render-slot.ts in the architecture?
render-slot.ts is located at src/core/instance/render-helpers/render-slot.ts (domain: CoreRuntime, subdomain: Instance, directory: src/core/instance/render-helpers).

Analyze Your Own Codebase

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

Try Supermodel Free