MCPcopy
hub / github.com/vuejs/core / normalizeObjectSlots

Function normalizeObjectSlots

packages/runtime-core/src/componentSlots.ts:121–149  ·  view source on GitHub ↗
(
  rawSlots: RawSlots,
  slots: InternalSlots,
  instance: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

119}
120
121const normalizeObjectSlots = (
122 rawSlots: RawSlots,
123 slots: InternalSlots,
124 instance: ComponentInternalInstance,
125) => {
126 const ctx = rawSlots._ctx
127 for (const key in rawSlots) {
128 if (isInternalKey(key)) continue
129 const value = rawSlots[key]
130 if (isFunction(value)) {
131 slots[key] = normalizeSlot(key, value, ctx)
132 } else if (value != null) {
133 if (
134 __DEV__ &&
135 !(
136 __COMPAT__ &&
137 isCompatEnabled(DeprecationTypes.RENDER_FUNCTION, instance)
138 )
139 ) {
140 warn(
141 `Non-function value encountered for slot "${key}". ` +
142 `Prefer function slots for better performance.`,
143 )
144 }
145 const normalized = normalizeSlotValue(value)
146 slots[key] = () => normalized
147 }
148 }
149}
150
151const normalizeVNodeSlots = (
152 instance: ComponentInternalInstance,

Callers 2

initSlotsFunction · 0.85
updateSlotsFunction · 0.85

Calls 6

isFunctionFunction · 0.90
isCompatEnabledFunction · 0.90
warnFunction · 0.90
isInternalKeyFunction · 0.85
normalizeSlotFunction · 0.85
normalizeSlotValueFunction · 0.85

Tested by

no test coverage detected