feat(custom-element): expose this.$host in Options API

This commit is contained in:
Evan You 2024-08-08 12:40:40 +08:00
parent 775103af37
commit 1ef8f46af0
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 2 additions and 0 deletions

View File

@ -313,6 +313,7 @@ export type ComponentPublicInstance<
$slots: UnwrapSlotsType<S>
$root: ComponentPublicInstance | null
$parent: ComponentPublicInstance | null
$host: Element | null
$emit: EmitFn<E>
$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 =>