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 VueCore Instance 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  981bd2a9_e269_1bf2_0982_c85b6a583247["render-slot.ts"]
  90a2398a_1498_3263_c62e_0c064dd2c9b3["index"]
  981bd2a9_e269_1bf2_0982_c85b6a583247 --> 90a2398a_1498_3263_c62e_0c064dd2c9b3
  973389ac_8625_30a3_53ce_b1b48fae58c5["vnode"]
  981bd2a9_e269_1bf2_0982_c85b6a583247 --> 973389ac_8625_30a3_53ce_b1b48fae58c5
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd["index.ts"]
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd --> 981bd2a9_e269_1bf2_0982_c85b6a583247
  style 981bd2a9_e269_1bf2_0982_c85b6a583247 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 VueCore 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: VueCore, 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