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
  fbca07e6_aa9c_0443_703f_c46ecf6696fa["genSlot()"]
  54260741_ae9d_a025_86de_47c513f5f82d["index.ts"]
  fbca07e6_aa9c_0443_703f_c46ecf6696fa -->|defined in| 54260741_ae9d_a025_86de_47c513f5f82d
  075d1f95_9965_89f4_3c01_f944fee6b553["genElement()"]
  075d1f95_9965_89f4_3c01_f944fee6b553 -->|calls| fbca07e6_aa9c_0443_703f_c46ecf6696fa
  9fb6810f_0f8d_c3be_a848_4600c5dd2c8d["genChildren()"]
  fbca07e6_aa9c_0443_703f_c46ecf6696fa -->|calls| 9fb6810f_0f8d_c3be_a848_4600c5dd2c8d
  11c959b5_53f2_f6ca_bb39_c51ca6580caf["genProps()"]
  fbca07e6_aa9c_0443_703f_c46ecf6696fa -->|calls| 11c959b5_53f2_f6ca_bb39_c51ca6580caf
  style fbca07e6_aa9c_0443_703f_c46ecf6696fa 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, defined in src/compiler/codegen/index.ts.
Where is genSlot() defined?
genSlot() is defined in src/compiler/codegen/index.ts at line 605.
What does genSlot() call?
genSlot() calls 2 function(s): 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