Home / Function/ normalizeScopedSlot() — vue Function Reference

normalizeScopedSlot() — vue Function Reference

Architecture documentation for the normalizeScopedSlot() function in normalize-scoped-slots.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  4654ec48_ee34_3880_324a_14ac626facd2["normalizeScopedSlot()"]
  ad2344e6_3a5b_8f6e_1810_1802147c80c8["normalizeScopedSlots()"]
  ad2344e6_3a5b_8f6e_1810_1802147c80c8 -->|calls| 4654ec48_ee34_3880_324a_14ac626facd2
  387f4cc0_d1d8_687f_b954_207658b1a562["setCurrentInstance()"]
  4654ec48_ee34_3880_324a_14ac626facd2 -->|calls| 387f4cc0_d1d8_687f_b954_207658b1a562
  00cce470_87b6_9803_7f03_3dd6786130a1["normalizeChildren()"]
  4654ec48_ee34_3880_324a_14ac626facd2 -->|calls| 00cce470_87b6_9803_7f03_3dd6786130a1
  bc7ed540_1860_7d1b_4b71_a8202f23371e["isAsyncPlaceholder()"]
  4654ec48_ee34_3880_324a_14ac626facd2 -->|calls| bc7ed540_1860_7d1b_4b71_a8202f23371e
  style 4654ec48_ee34_3880_324a_14ac626facd2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/vdom/helpers/normalize-scoped-slots.ts lines 65–93

function normalizeScopedSlot(vm, normalSlots, key, fn) {
  const normalized = function () {
    const cur = currentInstance
    setCurrentInstance(vm)
    let res = arguments.length ? fn.apply(null, arguments) : fn({})
    res =
      res && typeof res === 'object' && !isArray(res)
        ? [res] // single vnode
        : normalizeChildren(res)
    const vnode: VNode | null = res && res[0]
    setCurrentInstance(cur)
    return res &&
      (!vnode ||
        (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
      ? undefined
      : res
  }
  // this is a slot using the new v-slot syntax without scope. although it is
  // compiled as a scoped slot, render fn users would expect it to be present
  // on this.$slots because the usage is semantically a normal slot.
  if (fn.proxy) {
    Object.defineProperty(normalSlots, key, {
      get: normalized,
      enumerable: true,
      configurable: true
    })
  }
  return normalized
}

Domain

Subdomains

Frequently Asked Questions

What does normalizeScopedSlot() do?
normalizeScopedSlot() is a function in the vue codebase.
What does normalizeScopedSlot() call?
normalizeScopedSlot() calls 3 function(s): isAsyncPlaceholder, normalizeChildren, setCurrentInstance.
What calls normalizeScopedSlot()?
normalizeScopedSlot() is called by 1 function(s): normalizeScopedSlots.

Analyze Your Own Codebase

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

Try Supermodel Free