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
  d777a689_36b5_fe7e_de7e_1c8af4474401["genScopedSlot()"]
  e84bda34_0c0c_e448_e78b_daf80c632a02["genScopedSlots()"]
  e84bda34_0c0c_e448_e78b_daf80c632a02 -->|calls| d777a689_36b5_fe7e_de7e_1c8af4474401
  e7c86dbc_f669_e04c_eae5_85c469684781["genIf()"]
  d777a689_36b5_fe7e_de7e_1c8af4474401 -->|calls| e7c86dbc_f669_e04c_eae5_85c469684781
  6f9060e9_4d2c_0a9f_e876_7334660278e7["genFor()"]
  d777a689_36b5_fe7e_de7e_1c8af4474401 -->|calls| 6f9060e9_4d2c_0a9f_e876_7334660278e7
  a9c90cf9_5508_948e_464e_8e694711c96f["genChildren()"]
  d777a689_36b5_fe7e_de7e_1c8af4474401 -->|calls| a9c90cf9_5508_948e_464e_8e694711c96f
  ce806ab8_847b_273b_e07c_0a796c2f76ae["genElement()"]
  d777a689_36b5_fe7e_de7e_1c8af4474401 -->|calls| ce806ab8_847b_273b_e07c_0a796c2f76ae
  style d777a689_36b5_fe7e_de7e_1c8af4474401 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}}`
}

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