Home / Function/ genSlot() — vue Function Reference

genSlot() — vue Function Reference

Architecture documentation for the genSlot() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d["genSlot()"]
  4cfaef88_0bc8_30fc_0a01_09b4149fd58c["genElement()"]
  4cfaef88_0bc8_30fc_0a01_09b4149fd58c -->|calls| 42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d
  cf9f7290_7f9d_d856_7cf0_68de752b40b7["genChildren()"]
  42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d -->|calls| cf9f7290_7f9d_d856_7cf0_68de752b40b7
  8d77643c_f644_5b38_7cc9_470546920393["genProps()"]
  42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d -->|calls| 8d77643c_f644_5b38_7cc9_470546920393
  447f7b2d_d677_800e_b42e_db97e7d830a7["camelize()"]
  42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d -->|calls| 447f7b2d_d677_800e_b42e_db97e7d830a7
  style 42bea0e4_d68e_8c1a_27b1_d90fdcd8e88d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/codegen/index.ts lines 605–631

function genSlot(el: ASTElement, state: CodegenState): string {
  const slotName = el.slotName || '"default"'
  const children = genChildren(el, state)
  let res = `_t(${slotName}${children ? `,function(){return ${children}}` : ''}`
  const attrs =
    el.attrs || el.dynamicAttrs
      ? genProps(
          (el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
            // slot props are camelized
            name: camelize(attr.name),
            value: attr.value,
            dynamic: attr.dynamic
          }))
        )
      : null
  const bind = el.attrsMap['v-bind']
  if ((attrs || bind) && !children) {
    res += `,null`
  }
  if (attrs) {
    res += `,${attrs}`
  }
  if (bind) {
    res += `${attrs ? '' : ',null'},${bind}`
  }
  return res + ')'
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does genSlot() do?
genSlot() is a function in the vue codebase.
What does genSlot() call?
genSlot() calls 3 function(s): camelize, genChildren, genProps.
What calls genSlot()?
genSlot() is called by 1 function(s): genElement.

Analyze Your Own Codebase

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

Try Supermodel Free