什么是SPA?
单页Web应用(single page web application,SPA),就是只有一张Web页面的应用,是加载单个HTML 页面并在用户与应用程序交互时动态更新该页面的Web应用程序。
————引自百度百科 https://baike.baidu.com/item/SPA/17536313?fr=aladdin
实现SPA的三种方式:
1.监听地址栏中hash变化驱动界面变化
2.用pushsate记录浏览器的历史,驱动界面发送变化
3.直接在界面用普通事件驱动界面变化
它们都是遵循同一种原则:div 的显示与隐藏
关于hash与pushsate的相关解释请戳下面链接↓