admin管理员组文章数量:1405910
Today I started playing with NuxtJS and was wondering what the best way to set/retrieve global data would be?
For example a phone number that gets repeated throughout a site, should be managed from a single location.
Would AsyncData be the way to go? Is that overkill?
In Vue.js you'd have global data attached to the main Vue instance. What is the Nuxt equivalent of this (if there is one).
Today I started playing with NuxtJS and was wondering what the best way to set/retrieve global data would be?
For example a phone number that gets repeated throughout a site, should be managed from a single location.
Would AsyncData be the way to go? Is that overkill?
In Vue.js you'd have global data attached to the main Vue instance. What is the Nuxt equivalent of this (if there is one).
Share Improve this question asked Apr 30, 2018 at 13:23 crinklebatcrinklebat 3167 silver badges17 bronze badges 1- 1 Wouldn't state management like VueX a better approach in general for global data? Attaching data to the vue instance for the sake of data storage doesn't seem like a very flexible approach. Also vuex is directly supported by nuxt. – Philip Feldmann Commented Apr 30, 2018 at 13:36
1 Answer
Reset to default 5Take a look at Vuex, the vue state management pattern and library.
It serves as a centralized store for all the ponents in a vue application.
本文标签: javascriptNuxt JSWherehow to set global dataStack Overflow
版权声明:本文标题:javascript - Nuxt JS | Wherehow to set global data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744945016a2633720.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论