getCurrentInstance()
Returns the internal component instance during setup (advanced use).
Syntax
const instance = getCurrentInstance() Returns
ComponentInternalInstance | null — The active instance, or null outside setup.
Examples
<script setup lang="ts">
import { getCurrentInstance } from 'vue';
const instance = getCurrentInstance();
const appConfig = instance?.appContext.config;
</script>
Notes
An advanced, internal API intended for library authors. Only call it
synchronously during setup. Avoid relying on internal instance fields in
application code; prefer documented APIs (inject, useAttrs, etc.) which are
stable across versions.