cookie-umiversal-nuxt,服务器上的页面刷新丢失cookie数据

发布于 2025-02-07 05:06:31 字数 506 浏览 1 评论 0原文

我正在使用vuejs,nuxtjs empartiment cookie-universal-nuxt package.localhost工作所有内容,但是在刷新页面后,服务器不起作用。

nuxt.config.js

    export default {
     mode: 'universal',
     ssr: true,
     target: 'server',
     modules: ['cookie-universal-nuxt'],
     server: {
       port: 4002,
       host: 'localhost'
     }
   }

cart.js

$cookies.set('cart', cookieParams, {
   path: '/',
   maxAge: 60 * 60 * 24 * 7
});

i'm using vuejs, nuxtjs implement cookie-universal-nuxt package.Localhost work everything,but the server does not work after refreshing page.

nuxt.config.js

    export default {
     mode: 'universal',
     ssr: true,
     target: 'server',
     modules: ['cookie-universal-nuxt'],
     server: {
       port: 4002,
       host: 'localhost'
     }
   }

cart.js

$cookies.set('cart', cookieParams, {
   path: '/',
   maxAge: 60 * 60 * 24 * 7
});

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

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

发布评论

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

评论(1

放肆 2025-02-14 05:06:31

如果您使用的是babel,请尝试将软件包添加到 transpile transpile > nuxt.config中的部分。没有此软件包,有些软件包在SSR中无法正常工作,例如element-ui, @vuebits/bem,等。

If you're using babel, try adding the package to the transpile section in your nuxt.config. Some packages don't work in ssr correctly without this, e.g element-ui, @vuebits/bem, etc.

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