[Vuejs]-How can set server date config in nuxtjs

3👍

You could use the nuxtServerInit method and generate a timestamp from here:

In store/index.js:

actions: {
  nuxtServerInit ({ commit }) {
    commit('setNuxtTime', (new Date()).getTime())
  }
}

If the action nuxtServerInit is defined in the store, Nuxt.js will
call it with the context (only from the server-side). It’s useful when
we have some data on the server we want to give directly to the
client-side.

https://nuxtjs.org/guide/vuex-store#the-nuxtserverinit-action

Leave a comment