Answer the question
In order to leave comments, you need to log in
How to access global. Vue 3 variables?
Hello.
I'm slowly picking vue 3 and even fell into a stupor with the new composition API. How can I access for example $router, $store or other variables? They write on the Internet that the second setup parameter should have a root property, but I don’t have it and the documentation states that there are only 3 keys in this parameter (attrs, emit, slots)
There is an option through getCurrentInstance or import the instance from the plugin, but this kind of crutch
Answer the question
In order to leave comments, you need to log in
Found the answer in the documentation
https://composition-api.vuejs.org/#plugin-development
That's right. The context parameter must be the root object.
https://stackoverflow.com/a/58579885/7436149
PS I did not pick version 3 myself)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question