A
A
Andrew2019-12-06 11:09:26
Vue.js
Andrew, 2019-12-06 11:09:26

How to get access to the hooks of the entire application in nuxt?

In pure vue, there is an App.vue file, which has access to all application hooks and calls the necessary methods at the time of application initialization. How to repeat the same on nuxt?
I need to load categories in vuex regardless of which page the application was opened on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Pautov, 2019-12-06
@AndrewRusinas

It's called plugins! https://nuxtjs.org/api/configuration-plugins#the-p...
And if ssr - that is, in /store/index.js action nuxtServerInit
There is also an analogy nuxtServerInit, but for the client part - https:// www.npmjs.com/package/nuxt-client-init-module, same plugin wrapped in a module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question