@@ -21,9 +21,7 @@ import { isKeepAlive } from './components/KeepAlive'
2121import { type ContextualRenderFn , withCtx } from './componentRenderContext'
2222import { isHmrUpdating } from './hmr'
2323import { DeprecationTypes , isCompatEnabled } from './compat/compatConfig'
24- import { toRaw } from '@vue/reactivity'
25- import { trigger } from '@vue/reactivity'
26- import { TriggerOpTypes } from '@vue/reactivity'
24+ import { TriggerOpTypes , trigger } from '@vue/reactivity'
2725import { createInternalObject } from './internalObject'
2826
2927export type Slot < T extends any = any > = (
@@ -167,26 +165,18 @@ export const initSlots = (
167165 instance : ComponentInternalInstance ,
168166 children : VNodeNormalizedChildren ,
169167) => {
168+ const slots = ( instance . slots = createInternalObject ( ) )
170169 if ( instance . vnode . shapeFlag & ShapeFlags . SLOTS_CHILDREN ) {
171170 const type = ( children as RawSlots ) . _
172171 if ( type ) {
173- // users can get the shallow readonly version of the slots object through `this.$slots`,
174- // we should avoid the proxy object polluting the slots of the internal instance
175- instance . slots = toRaw ( children as InternalSlots )
172+ extend ( slots , children as InternalSlots )
176173 // make compiler marker non-enumerable
177- def ( instance . slots , '_' , type )
174+ def ( slots , '_' , type )
178175 } else {
179- normalizeObjectSlots (
180- children as RawSlots ,
181- ( instance . slots = createInternalObject ( ) ) ,
182- instance ,
183- )
184- }
185- } else {
186- instance . slots = createInternalObject ( )
187- if ( children ) {
188- normalizeVNodeSlots ( instance , children )
176+ normalizeObjectSlots ( children as RawSlots , slots , instance )
189177 }
178+ } else if ( children ) {
179+ normalizeVNodeSlots ( instance , children )
190180 }
191181}
192182
0 commit comments