refs: Data
emit: EmitFn
- attrsProxy: Data | null
- slotsProxy: Slots | null
-
/**
* used for keeping track of .once event handlers on components
* @internal
setupState: EMPTY_OBJ,
setupContext: null,
- attrsProxy: null,
- slotsProxy: null,
-
// suspense related
suspense,
suspenseId: suspense ? suspense.pendingId : 0,
* Dev-only
*/
function getSlotsProxy(instance: ComponentInternalInstance): Slots {
- return (
- instance.slotsProxy ||
- (instance.slotsProxy = new Proxy(instance.slots, {
- get(target, key: string) {
- track(instance, TrackOpTypes.GET, '$slots')
- return target[key]
- },
- }))
- )
+ return new Proxy(instance.slots, {
+ get(target, key: string) {
+ track(instance, TrackOpTypes.GET, '$slots')
+ return target[key]
+ },
+ })
}
export function createSetupContext(
// We use getters in dev in case libs like test-utils overwrite instance
// properties (overwrites should not be done in prod)
let attrsProxy: Data
+ let slotsProxy: Slots
return Object.freeze({
get attrs() {
return (
)
},
get slots() {
- return getSlotsProxy(instance)
+ return slotsProxy || (slotsProxy = getSlotsProxy(instance))
},
get emit() {
return (event: string, ...args: any[]) => instance.emit(event, ...args)