前端SPA(single page web application单页面应用not水疗)

  • SPA搜到是 水疗 emmmm…而此处浅谈单页Web应用(single page web application,SPA)
  • 首先一个网站一个页面????表示很疑惑
    单页面应用,就是把整个项目的所有页面的所有内容分成了很多的小块(就是组件),可以重复利用的,可以任意调整的组件,每个组件就是一个独立的部分(包括html,css和javascript代码)。再做一个html(基本上啥也没有),这个html就是一个页面容器,需要放那个组件时,直接引入就行。跳转时,直接跳转组件就行。当需要加载某个组件时,js会动态创建这些组件里的HTML,CSS。增加了同一网站中各网页相同组件的复用,减少了网络请求时间。用户体验更好。

转载:https://blog.csdn.net/jiang7701037/article/details/93243545(本文还介绍了传统多页面网站和单页面的对比)

  • 单页面的应用优点:
1.分离前后端关注点,前端负责界面显示,后端负责数据存储和计算。不会把前后端的逻辑
混杂在一起;
2.减轻服务器压力,服务器只用出数据就可以;
3.同一套后端程序代码,不用修改就可以用于Web界面、手机、平板等多种客户端;
4.用户体验好、快,内容改变不需要重新加载整个页面,web应用更具响应性和更令人着迷;
5.SPA和RESTful架构一起使用,后端不再负责模板渲染、输出页面工作,web前端和各种
移动终端地位对等,后端API通用化;
  • 单页面的应用缺点:
1.初次加载耗时相对增多;
2.导航不可用,如果一定要导航需要自行实现前进、后退,需要程序来实现管理;
3.使用脚本修改页面,这个脚本我们都知道,他的兼容性是个大问题;
4.不利于SEO(搜索引擎优化)问题,现在可以通过Prerender等技术解决一部分;

转载:https://blog.csdn.net/weixin_41646716/article/details/80073995

注:seo优化是什么意思?

In Single Page Web Applications you’ll learn to build modern browser-based apps that take advantage of stronger client platforms and more predictable bandwidth. You’ll learn the SPA design approach, and then start exploring new techniques like structured JavaScript and responsive design. And you’ll learn how to capitalize on trends like server-side JavaScript and NoSQL data stores, as well as new frameworks that make JavaScript more manageable and testable as a first-class language. If your website is a jumpy collection of linked pages, you are behind. Single page web applications are your next step: pushing UI rendering and business logic to the browser and communicating with the server only to synchronize data, they provide a smooth user experience, much like a native application. But, SPAs can be hard to develop, manage, and test. Single Page Web Applications shows how your team can easily design, test, maintain, and extend sophisticated SPAs using JavaScript end-to-end, without getting locked into a framework. Along the way, you’ll develop advanced HTML5, CSS3, and JavaScript skills, and use JavaScript as the language of the web server and the database. This book assumes basic knowledge of web development. No experience with SPAs is required. What’s Inside Design, build, and test a full-stack SPA Best-in-class tools like jQuery, TaffyDB, Node.js, and MongoDB Real-time web with web sockets and Socket.IO Touch controls for tablets and smartphones Common SPA design mistakes Table of Contents Part 1: Introducing SPAs Chapter 1. Our first single page application Chapter 2. Reintroducing JavaScript Part 2: The SPA client Chapter 3. Develop the Shell Chapter 4. Add feature modules Chapter 5. Build the Model Chapter 6. Finish the Model and Data modules Part 3: The SPA server Chapter 7. The web server Chapter 8. The server database Chapter 9. Readying our SPA for production Appendix A. JavaScript coding standard Appendix B. Testing an SPA Book Details Paperback: 432 pages Publisher: Manning Publications (September 2013) Language: English ISBN-10: 1617290750 ISBN-13: 978-1617290756
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值