NUXT.JS服务器端渲染如何工作?

发布于 2025-02-12 14:08:47 字数 1399 浏览 0 评论 0原文

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

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

发布评论

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

评论(1

后来的我们 2025-02-19 14:08:48

我正在使用NUXT 3,据我所知,您可以在客户端和服务器中使用useasyncdata()usefetch()。 NUXT 3 SSR Universal可以与SEO一起使用,因为爬网不是缓存文件,因此每个请求都是分开的,因此爬网每次从服务器中获得SSR HTML文件时。您可以使用秘密,如果您要在“服务器”文件夹中创建API调用,则可以单独的功能来使API调用它而不是使用网页。调用此API仅发送用户,例如JSON文件,而不是服务器/*。JS文件中的整个代码。

I'm working with Nuxt 3 and as far as I know you can use useAsyncData() and useFetch() in both client and server. Nuxt 3 SSR universal works fine with SEO because crawlers not cache files so every request is separate, so crawlers get every time SSR HTML file from server. You can use secrets if beside web page you want to create API calls from "server" folder, this is separate functionality to make API calls it not marge with web page. Calling this API will send user only for example JSON file, not whole code from a server/*.js files.

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