问题标签 [nuxtserverinit]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
module - 添加到 nuxt 应用程序时不会调用 nuxt 模块的 nuxtServerInit
我创建了一个 Nuxt 模块,它的 store 模块中有一个 nuxtServerInit 方法。我将它链接到 store 文件夹下的 index.js,因为在 vuex 模块模式下,只有 index.js 文件可以调用 nuxtServerInit。然而,主应用程序的存储(我正在添加我的自定义模块)是空的。我不确定如何进行。我希望在呈现页面之前触发我的自定义模块中的 nuxtServerInit ,但是没有任何反应。
~/modules/my_module/store/modules/user.js
~/modules/my_module/store/index.js
~/store/index.js