0👍
Currently i haven’t found a solution but an alternative in this article
How to create a global snackbar using Nuxt, Vuetify and Vuex.
IMHO this isn’t as "clean" as a plugin since the listening component sits in /layouts/default
rather than the nuxt/vue context and therefore needs to be added it in all layouts to work.
I guess a workaround would be a "base" layout from which the all other layouts need to inherit
- [Vuejs]-Vue3, getting state value from store to vue isn't working
- [Vuejs]-Randomising the answers in a multiple choice quiz game
0👍
Found the answer to this just now! I’ve been try to search for this for quite some time now as well.
You can access the root Vue instance used by Nuxt from the client as window.$nuxt
(which is the same as this.$root
inside the Vue components).
For your code, use window.$nuxt.$vuetify.application
on the calling code.
NOTE: If you are using this on the plugin creation itself, make sure to wait for the Nuxt instance to be created first, by either doing a setTimeout, hooking through a module, or adding a component event, because the Nuxt instance has not been created yet.
EDIT: Fixed the sentence wording and added some insight.
- [Vuejs]-Vue3 – Build Progress displays RouterLink but not RouterView
- [Vuejs]-NuxtJS /Vue not firing scroll event