Provide client version of nuxtServerInit
The nuxtClientInit module is a module for Nuxt.js that provides the ability to inject processing at client initialization. It is similar to the nuxtServerInit module but is executed only on the client-side rendering, in the root Vuex module.
npm install nuxt-client-init-module
nuxt.config.js
file, add the module to the modules
section:{
modules: [
'nuxt-client-init-module'
// other modules
]
}
index.js
file, you can now implement the nuxtClientInit action:export const actions = {
nuxtClientInit({ commit }) {
// your initialization logic here
}
}
Note: Make sure that the nuxt-client-init-module
appears earlier in the modules section of your nuxt.config.js
file if you need to use other modules during the nuxtClientInit process.
The nuxtClientInit module provides Nuxt.js users with the ability to execute actions only on the client-side rendering. It can be easily installed and used in Nuxt.js projects, and works well with other modules that may be required during the client-side initialization process.