Last active
March 8, 2022 15:10
-
-
Save techbysalma/459f0ce33376412458cca2acb0eabebb to your computer and use it in GitHub Desktop.
get current instance vuejs3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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