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
  957c0d47_da61_bbd7_c2c0_6ec005373124["genScopedSlot()"]
  d1ccd3d8_f5cf_7075_df2f_38965de3798e["genScopedSlots()"]
  d1ccd3d8_f5cf_7075_df2f_38965de3798e -->|calls| 957c0d47_da61_bbd7_c2c0_6ec005373124
  e458f6c9_a80f_c2c4_a63b_541be2a8b2b9["genIf()"]
  957c0d47_da61_bbd7_c2c0_6ec005373124 -->|calls| e458f6c9_a80f_c2c4_a63b_541be2a8b2b9
  57deee28_aac6_0fbe_7eff_db2c78f58dbf["genFor()"]
  957c0d47_da61_bbd7_c2c0_6ec005373124 -->|calls| 57deee28_aac6_0fbe_7eff_db2c78f58dbf
  cf9f7290_7f9d_d856_7cf0_68de752b40b7["genChildren()"]
  957c0d47_da61_bbd7_c2c0_6ec005373124 -->|calls| cf9f7290_7f9d_d856_7cf0_68de752b40b7
  4cfaef88_0bc8_30fc_0a01_09b4149fd58c["genElement()"]
  957c0d47_da61_bbd7_c2c0_6ec005373124 -->|calls| 4cfaef88_0bc8_30fc_0a01_09b4149fd58c
  style 957c0d47_da61_bbd7_c2c0_6ec005373124 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.
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