From 1ef8f46af0cfdec2fed66376772409e0aa25ad50 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 8 Aug 2024 12:40:40 +0800 Subject: [PATCH] feat(custom-element): expose this.$host in Options API --- packages/runtime-core/src/componentPublicInstance.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index 9ab6df52d6d..ac0b910dc20 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -313,6 +313,7 @@ export type ComponentPublicInstance< $slots: UnwrapSlotsType $root: ComponentPublicInstance | null $parent: ComponentPublicInstance | null + $host: Element | null $emit: EmitFn $el: any $options: Options & MergedComponentOptionsOverride @@ -371,6 +372,7 @@ export const publicPropertiesMap: PublicPropertiesMap = $refs: i => (__DEV__ ? shallowReadonly(i.refs) : i.refs), $parent: i => getPublicInstance(i.parent), $root: i => getPublicInstance(i.root), + $host: i => i.ce, $emit: i => i.emit, $options: i => (__FEATURE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type), $forceUpdate: i =>