Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
168
第 16章
单页应用
术语
单页应用
(
SPA
)多少有些命名不当,或者至少混淆了“页”的两种含义。从用户
的角度看来,
S
PA
也可以(实际上通常也是)表现为多个页面:主页、度假产品列表页、
“关于”页,等等。事实上,的确可以创建出一个让用户无法分辨是传统服务器端渲染的
还是
S
PA
的应用。
“单页”更多的是体现在
HTML
在什么位置以及如何构造
,而不是用户的体验。在一个
SPA
中,
当用户第一次加载应用的时候,服务器会发送单个的
HTML
资源包
1
,而且,任何
UI
的变化都是
JavaScript
操作
DOM
的结果,而这是为了响应用户活动或网络事件。
虽然
S
PA
也需要频繁地跟服务器通信,但
HTML
通常只在第一次请求时作为响应的一部
分发送过来。之后,在客户端和服务器之间只会传输
JSON
数据和静态资源文件。
这就是现今统治性的
We
b
应用开发方法,要理解其中的原因,首先需要了解一点儿历史。
16.1
 
Web
应用开发简史
虽然在过去
10
年中,
Web
开发方法已经发生了翻天覆地的变化,但有些东西还是保留下
来了,那就是网站或
We
b
应用所涉及的几个组件。
• HTML
和文档对象模型(
DOM
)
• JavaScript
• CSS
注
1
:
出于性能考虑,资源包也许会被分割为按需加载(称为
懒加载
)的多个“组块”,但原理是一样的。
单页应用
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua
前端架构设计

前端架构设计

Micah Godbolt

Publisher Resources

ISBN: 9787115565099