NUXTJS3支持NuxtServerinit

发布于 2025-02-04 12:52:54 字数 121 浏览 2 评论 0 原文

我使用PINIA在NUXTJS 3中创建数据。它可以正常工作,但是我想检查数据是否通过服务器渲染,而不仅仅是客户端。 我该如何确定? NUXTSERVERINIT是否在NUXTJS 3的新版本中支持NuxtServerinit?

I used Pinia for creating a data in Nuxtjs 3. It works correctly, But I'd like to check that the data is rendered through the server not just client.
How can I be sure about that? and Does nuxtServerInit is supported in new version of Nuxtjs 3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

债姬 2025-02-11 12:52:54

您可以在创建插件中

export default defineNuxtPlugin((nuxtApp) => {
  if (process.server) {
    // ...
  }
})

找到与PINIA相关的确切答案:
https://github.com/github.com/vuejs/pinia/pinia/discussions/947 #descoldcomment-1943854

主要来源:

编辑:省略导入为NUXT

You can try us this within creating plugin

export default defineNuxtPlugin((nuxtApp) => {
  if (process.server) {
    // ...
  }
})

Found exact answer related to Pinia:
https://github.com/vuejs/pinia/discussions/947#discussioncomment-1943854

Main source: https://v3.nuxtjs.org/bridge/bridge-composition-api#definenuxtplugin

EDIT: omit the import as Nuxt handle it

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文