Home / Function/ genScopedSlot() — vue Function Reference

genScopedSlot() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  27804826_1536_d9f6_16a0_0b84b98233f7["genScopedSlot()"]
  54260741_ae9d_a025_86de_47c513f5f82d["index.ts"]
  27804826_1536_d9f6_16a0_0b84b98233f7 -->|defined in| 54260741_ae9d_a025_86de_47c513f5f82d
  118a5b53_0e80_5668_cad0_a973c510ef35["genScopedSlots()"]
  118a5b53_0e80_5668_cad0_a973c510ef35 -->|calls| 27804826_1536_d9f6_16a0_0b84b98233f7
  e9890815_0d7c_a227_7123_bb7fe2649918["genIf()"]
  27804826_1536_d9f6_16a0_0b84b98233f7 -->|calls| e9890815_0d7c_a227_7123_bb7fe2649918
  5219b9aa_5abd_868e_f9ef_1a376162c229["genFor()"]
  27804826_1536_d9f6_16a0_0b84b98233f7 -->|calls| 5219b9aa_5abd_868e_f9ef_1a376162c229
  9fb6810f_0f8d_c3be_a848_4600c5dd2c8d["genChildren()"]
  27804826_1536_d9f6_16a0_0b84b98233f7 -->|calls| 9fb6810f_0f8d_c3be_a848_4600c5dd2c8d
  075d1f95_9965_89f4_3c01_f944fee6b553["genElement()"]
  27804826_1536_d9f6_16a0_0b84b98233f7 -->|calls| 075d1f95_9965_89f4_3c01_f944fee6b553
  style 27804826_1536_d9f6_16a0_0b84b98233f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/codegen/index.ts lines 489–511

function genScopedSlot(el: ASTElement, state: CodegenState): string {
  const isLegacySyntax = el.attrsMap['slot-scope']
  if (el.if && !el.ifProcessed && !isLegacySyntax) {
    return genIf(el, state, genScopedSlot, `null`)
  }
  if (el.for && !el.forProcessed) {
    return genFor(el, state, genScopedSlot)
  }
  const slotScope =
    el.slotScope === emptySlotScopeToken ? `` : String(el.slotScope)
  const fn =
    `function(${slotScope}){` +
    `return ${
      el.tag === 'template'
        ? el.if && isLegacySyntax
          ? `(${el.if})?${genChildren(el, state) || 'undefined'}:undefined`
          : genChildren(el, state) || 'undefined'
        : genElement(el, state)
    }}`
  // reverse proxy v-slot without scope on this.$slots
  const reverseProxy = slotScope ? `` : `,proxy:true`
  return `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does genScopedSlot() do?
genScopedSlot() is a function in the vue codebase, defined in src/compiler/codegen/index.ts.
Where is genScopedSlot() defined?
genScopedSlot() is defined in src/compiler/codegen/index.ts at line 489.
What does genScopedSlot() call?
genScopedSlot() calls 4 function(s): genChildren, genElement, genFor, genIf.
What calls genScopedSlot()?
genScopedSlot() is called by 1 function(s): genScopedSlots.

Analyze Your Own Codebase

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

Try Supermodel Free