Skip to content

Commit 9a38c1f

Browse files
committed
refactor
1 parent 317478c commit 9a38c1f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/runtime-vapor/src/componentSlots.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ export function initSlots(
4040
if (!rawSlots) return
4141
if (!isArray(rawSlots)) rawSlots = [rawSlots]
4242

43-
const hasDynamicSlot = rawSlots.some(slot => isDynamicSlotFn(slot))
44-
if (!hasDynamicSlot) {
43+
if (!rawSlots.some(slot => isDynamicSlotFn(slot))) {
4544
instance.slots = {}
4645
// with ctx
4746
const slots = rawSlots[0] as StaticSlots
@@ -51,7 +50,7 @@ export function initSlots(
5150
return
5251
}
5352

54-
const resolved: StaticSlots = (instance.slots = shallowReactive({}))
53+
instance.slots = shallowReactive({})
5554
const keys: Set<string>[] = []
5655
rawSlots.forEach((slots, index) => {
5756
const isDynamicSlot = isDynamicSlotFn(slots)
@@ -77,7 +76,7 @@ export function initSlots(
7776
: dynamicSlot && dynamicSlot.name === name)
7877
) {
7978
recordNames.delete(name)
80-
delete resolved[name]
79+
delete instance.slots[name]
8180
}
8281
}
8382
})
@@ -89,7 +88,7 @@ export function initSlots(
8988
})
9089

9190
function registerSlot(name: string, fn: Slot, recordNames?: Set<string>) {
92-
resolved[name] = withCtx(fn)
91+
instance.slots[name] = withCtx(fn)
9392
recordNames && recordNames.add(name)
9493
}
9594

0 commit comments

Comments
 (0)