@@ -21,9 +21,7 @@ import { isKeepAlive } from './components/KeepAlive'
21
21
import { type ContextualRenderFn , withCtx } from './componentRenderContext'
22
22
import { isHmrUpdating } from './hmr'
23
23
import { 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'
27
25
import { createInternalObject } from './internalObject'
28
26
29
27
export type Slot < T extends any = any > = (
@@ -167,26 +165,18 @@ export const initSlots = (
167
165
instance : ComponentInternalInstance ,
168
166
children : VNodeNormalizedChildren ,
169
167
) => {
168
+ const slots = ( instance . slots = createInternalObject ( ) )
170
169
if ( instance . vnode . shapeFlag & ShapeFlags . SLOTS_CHILDREN ) {
171
170
const type = ( children as RawSlots ) . _
172
171
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 )
176
173
// make compiler marker non-enumerable
177
- def ( instance . slots , '_' , type )
174
+ def ( slots , '_' , type )
178
175
} 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 )
189
177
}
178
+ } else if ( children ) {
179
+ normalizeVNodeSlots ( instance , children )
190
180
}
191
181
}
192
182
0 commit comments