vuex -> 商店消失 'refresh'
vuex -> store gone with 'refresh'
在我的 nuxt.js 应用程序中,我配置了一个商店,我在其中设置默认值,该值随特定操作而变化。但是,如果我例如直接进入某个页面,则无法使用商店信息。我得到一个错误 [nuxt.js] Cannot load components TypeError: Cannot read property 'state' of undefined at Object.data
它按预期工作,因为 Vuex 不保持刷新状态。您需要在您的商店中使用 NuxtServerInit 操作再次获取并填充商店。请先阅读文档,里面都有。
尝试 persistedState
Vuex
插件。
并在 Vuex
中的 nuxtServerInit
操作中获取数据。
在我的 nuxt.js 应用程序中,我配置了一个商店,我在其中设置默认值,该值随特定操作而变化。但是,如果我例如直接进入某个页面,则无法使用商店信息。我得到一个错误 [nuxt.js] Cannot load components TypeError: Cannot read property 'state' of undefined at Object.data
它按预期工作,因为 Vuex 不保持刷新状态。您需要在您的商店中使用 NuxtServerInit 操作再次获取并填充商店。请先阅读文档,里面都有。
尝试 persistedState
Vuex
插件。
并在 Vuex
中的 nuxtServerInit
操作中获取数据。