NUXT3:SSR直接导航,客户端在应用内导航上获取
因此,我们有一个带有页面/thick
的NUXT3应用程序,该应用程序使用endpoint /api/thing
的数据渲染内容,但也也用于生成动态元数据在SSR期间(用于SEO和社交卡)。
现在,pages/thing.vue
use usefetch
在SSR期间获取数据(良好或动态元数据,对UX不利,因为阻止了导航)。
理想情况下,我们将使用usefetch
如果客户端直接导航到/thing
(例如,通过在其浏览器中键入并按ENTER),但请使用非nvigation-阻止uselazyfetch
并在客户端在我们的应用中导航时在前端显示加载页面。
如何实现?
So we have a Nuxt3 application with a page /thing
which uses data from endpoint /api/thing
to render content but also for generating dynamic metadata during SSR (for SEO and social cards).
Now, pages/thing.vue
uses useFetch
which fetches the data during SSR (good or dynamic metadata, bad for UX since blocks navigation).
Ideally, we'd have it use useFetch
if the client is navigating to /thing
directly (e.g. by typing it in their browser and pressing enter) but use non-navigation-blocking useLazyFetch
and show a loading page on the front-end when the client is navigating within our app.
How can that be achieved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论