- Objective:
- Breadcrumb:
# 概念阐释
Single-Page Application, 在一个web地址下更换单个HTML shell中的DOM,无需做任何路由,实现跳转更快。
> a web application that interacts with the web browser by dynamically rewriting the current web page with new data from a web server, instead of the default method of the browser loading entire new pages.一个与网络浏览器交互的网络应用程序,通过从网络服务器获取新数据并动态地重写当前网页,而不是浏览器加载整个新页面的默认方法。—— Wikipedia
## 优势
- 快速,像一个桌面应用或移动程序
- 代码重用节省了很多时间
- 迁移到移动程序中更加简洁
## 劣势
- 启动SPA时需要更多文件,因此[[Web app]]的加载时间会更长。通过在应用程序运行期间策略性地加载资源,可以将SPA的加载时间最小化。
- SEO对网站的页面进行索引以排名内容,但只有一个页面可能会带来困难,不过随着时间的变化,这一不利因素也会得到优化
- 在浏览器中的行为可能会超出预期,比如按返回或浏览历史记录时会出现问题
# 实例
使用SPA的[[客户端编程|前端框架]]:
- React
- Vue.js
# 相关内容
# 参考资料
- [What is a SPA?](https://www.codecademy.com/journeys/full-stack-engineer/paths/fscj-22-front-end-development/tracks/fscj-22-web-apps/modules/wdcp-22-what-is-a-web-app-5eb16c27-b4a6-4972-a215-47547335434b/articles/fecp-what-is-a-spa)