We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
前端路由是现代单页应用的基础,目前有两种实现思路:
hash路由是一个带有# 的路由,我们主要是监听url中的hash变化来进行路由跳转。
#
监听事件:load和hashchange
load
hashchange
优点是兼容性良好,缺点是URL中一直存在#,使得url不美观
我们可以直接使用window.history中方法,,里面有几个方法可以实现变更url但是不刷新路由,具体的API可以参考MDN
window.history
The text was updated successfully, but these errors were encountered:
No branches or pull requests
前端路由是现代单页应用的基础,目前有两种实现思路:
基于HASH的实现方式
hash路由是一个带有
#
的路由,我们主要是监听url中的hash变化来进行路由跳转。监听事件:
load
和hashchange
优点缺点
优点是兼容性良好,缺点是URL中一直存在
#
,使得url不美观基于H5 history实现方式
我们可以直接使用
window.history
中方法,,里面有几个方法可以实现变更url但是不刷新路由,具体的API可以参考MDNThe text was updated successfully, but these errors were encountered: