]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(custom-element): expose this.$host in Options API
authorEvan You <evan@vuejs.org>
Thu, 8 Aug 2024 04:40:40 +0000 (12:40 +0800)
committerEvan You <evan@vuejs.org>
Thu, 8 Aug 2024 04:40:40 +0000 (12:40 +0800)
packages/runtime-core/src/componentPublicInstance.ts

index 9ab6df52d6d795855e741cb5861dca675e2e035e..ac0b910dc20d40571f430f48e664cf08757f5a41 100644 (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 =>