当前位置:网站首页>Nuxt - Universal (SSR / SSG) / single page app (rendering mode)
Nuxt - Universal (SSR / SSG) / single page app (rendering mode)
2022-06-22 18:02:00 【Wangjiabin】
Preface
Current front-end rendering mode , Roughly divided into 3 Kind of , Interested can Check out this article .
- Client rendering CSR (Croswer Side Render)
- Server rendering SSR (Server Side Render)
- Static website generation SSG (Static Site Generation)
When you create a project , Do you remember such a multiple-choice question as the following :

Nuxt.js Will let you choose a rendering mode , Let's make a good analysis .
One 、Universal(SSR / SSG)
from
UniversalLook at the English words , It's broad 、 general , More common rendering modes .
After you select , It includes ( built-in ) Server side rendering (SSR) And static website generation (SSG) Two rendering modes .
Server rendering (SSR):
Server-side rendering means that the client sends a request to the server , Then the runtime dynamically generates html Content and return to the client .

Pictured above , Use Universal Pattern , Any routing request ( Not activated Vue ) The following operations will be performed :
- Render the requested page on the server side
- The browser gets the new page and the new page displays
- request JavaScript file
- start-up Vue, The page has basically become a regular SPA
route :

Pictured above , Launch... In the browser Vue after , Routing operations are as follows :
- Sent out a JavaScript request , Render with inheritance only /about-us Required for page components JavaScript
- Conduct API Call to get the data to render
- Render the page
Nuxt.jsThe code splitting function is used by default , And split each page into differentJavaScriptfile , These files are loaded only when needed . such , Our application does not pre download a large amount of component code that may or may not have been loaded .
Static website generation (SSG):
This is simple , Static website rendering is performed at build time , When making a request , Direct will html Send back to client .
The original web pages are all like this .
Two 、Single Page App
In English , It means a single page application ( There's only one page ), You might as well spell the first letters of three words together ,SPA!
After you select , It is equivalent to rendering according to the single page application mode .
In ordinary Web In the application , When the user requests http://myapp.com/about-us When the server returns normally about-us.html.

Pictured , In a single page application , Any routing request will do the following :
- download index.html
- download Vue Applications JavaScript
- initialization Vue application
- initialization Vue Router And route to the appropriate component
- Conduct API Call to get the data to render
- Render the page
SPA The initial load of the application may be slow , Once the load is complete , fast .
Written in the back
Generally speaking , Static website rendering is faster at run time , Because there is no need for the server to handle , But the disadvantage is that any change to the data needs to be completely rebuilt on the server side ; The server-side rendering will dynamically process the data , No complete reconstruction is required .
in addition , use Nuxt.js The main thing is server-side rendering (SSR).
边栏推荐
- 短视频直播源码,EditText输入框的使用
- 可能是全网最全的Matplotlib可视化教程
- 【人脸识别】基于GoogleNet深度学习网络的人脸识别matlab仿真
- clickhouse 21.x 集群四分片一副本部署
- 请问一下flink mysql-cdc 如何保证server_id全局唯一呢?
- 数据库行业分析:从全球IT产业趋势到国产数据库发展之路
- clickhouse 21. X cluster four piece one copy deployment
- [small program project development -- Jingdong Mall] rotation chart of uni app development
- Binary tree practice the second bullet
- 关于#数据库#的问题,如何解决?
猜你喜欢

【FPGA+PWM】基于FPGA的三相PWM整流器移相触发电路的设计与实现

【win11】注册表修改fix 右键没有新建

STM32 series (HAL Library) - f103c8t6 hardware SPI illuminates OLED screen with word library

Social responsibility: GAC Honda advocates children's road traffic safety in "dream children's travel"

TypeScript(7)泛型

Content recommendation process

推荐7款超级好用的终端工具 —— SSH+FTP

Typescript (7) generic

Quartus prime 18.0 software installation package and installation tutorial

Xftp 7(FTP/SFTP客户端) V7.0.0107 官方中文免费正式版(附文件+安装教程)
随机推荐
内容推荐流程
Typescript (7) generic
Ad20/altium Designer - oil for manhole cover
You call this crap high availability?
Xftp 7(FTP/SFTP客户端) V7.0.0107 官方中文免费正式版(附文件+安装教程)
Read Apache shardingsphere
基于转换器 (MMC) 技术和电压源转换器 (VSC) 的高压直流 (HVDC) 模型(Matlab&Simulink实现)
请问一下,CDC2.0在读取mysql的时候,应该是没有表锁了吧,刚刚报了一个错误,access d
Development mode of JSP learning
Is flush easy to open an account? Is it safe to open an account online?
STM32系列(HAL库)——F103C8T6硬件SPI点亮带字库OLED屏
The win10 desktop icon disappears and the toolbar turns black
Hello playwright: (7) simulate keyboard and mouse
Mybaits:常用数据库操作(东软的操作)
Make it more automatic to transfer slow logs and audit logs of RDS (for MySQL) databases to OBS across spaces
让RDS(for MySQL)数据库的慢日志、审计日志跨空间转存OBS变得更加自动化
诺亚财富拟登陆港交所:第一季度业绩大幅下滑,曾踩雷“承兴案”
Quickly master asp Net authentication framework identity - user registration
可能是全网最全的Matplotlib可视化教程
It may be the most comprehensive Matplotlib visualization tutorial in the whole network