resolveSlots() — vue Function Reference
Architecture documentation for the resolveSlots() function in resolve-slots.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD d8821cb4_3136_e465_ecc1_56f86574ae34["resolveSlots()"] 75058e43_64c9_ef74_0dc8_3767f108116b["updateChildComponent()"] 75058e43_64c9_ef74_0dc8_3767f108116b -->|calls| d8821cb4_3136_e465_ecc1_56f86574ae34 fa879678_0767_c9f5_f3e2_55c3620ec148["initRender()"] fa879678_0767_c9f5_f3e2_55c3620ec148 -->|calls| d8821cb4_3136_e465_ecc1_56f86574ae34 2a3d2c68_f002_d816_7b35_bdbc95f4434c["FunctionalRenderContext()"] 2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| d8821cb4_3136_e465_ecc1_56f86574ae34 style d8821cb4_3136_e465_ecc1_56f86574ae34 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/render-helpers/resolve-slots.ts lines 7–47
export function resolveSlots(
children: Array<VNode> | null | undefined,
context: Component | null
): { [key: string]: Array<VNode> } {
if (!children || !children.length) {
return {}
}
const slots: Record<string, any> = {}
for (let i = 0, l = children.length; i < l; i++) {
const child = children[i]
const data = child.data
// remove slot attribute if the node is resolved as a Vue slot node
if (data && data.attrs && data.attrs.slot) {
delete data.attrs.slot
}
// named slots should only be respected if the vnode was rendered in the
// same context.
if (
(child.context === context || child.fnContext === context) &&
data &&
data.slot != null
) {
const name = data.slot
const slot = slots[name] || (slots[name] = [])
if (child.tag === 'template') {
slot.push.apply(slot, child.children || [])
} else {
slot.push(child)
}
} else {
;(slots.default || (slots.default = [])).push(child)
}
}
// ignore slots that contains only whitespace
for (const name in slots) {
if (slots[name].every(isWhitespace)) {
delete slots[name]
}
}
return slots
}
Domain
Subdomains
Source
Frequently Asked Questions
What does resolveSlots() do?
resolveSlots() is a function in the vue codebase.
What calls resolveSlots()?
resolveSlots() is called by 3 function(s): FunctionalRenderContext, initRender, updateChildComponent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free