logo

该视频仅会员有权观看

立即开通课程「Nuxt.js 前端应用开发实践」权限。

¥
199
/ 年

Nuxt 框架的客户端渲染(CSR)与服务端渲染(SSR)

  • NX GS supports both client-side and server-side rendering.
  • Client-side rendering is done in the browser with JavaScript; the content is not in the HTML initially served from the server.
  • Server-side rendering generates the necessary HTML on the server before it's sent to the browser, which can improve performance and SEO.
  • To toggle server-side rendering in NX, locate nx config file in the root project directory and set the ssr (Server Side Rendering) property to false.
  • With SSR disabled, content rendered by JavaScript won’t be found in the page's source code when viewing the page source after a refresh.
  • Enabling SSR again in NX allows for server-side rendering with a cross-platform server engine that can run in environments like Node.js and Edge.