Skip to content

Instantly share code, notes, and snippets.

@techbysalma
Last active March 8, 2022 15:10
Show Gist options
  • Select an option

  • Save techbysalma/459f0ce33376412458cca2acb0eabebb to your computer and use it in GitHub Desktop.

Select an option

Save techbysalma/459f0ce33376412458cca2acb0eabebb to your computer and use it in GitHub Desktop.
get current instance vuejs3
<script>
import { onMounted, getCurrentInstance } from 'vue'
export default {
name: 'Component',
props: {
name: {
type: String,
default: '',
},
},
setup() {
const instance = getCurrentInstance();
onMounted(() => {
console.log({ instance: instance })
})
}
}
</script>
<template></template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment