location 地址: 地址栏相关的信息
host: "127.0.0.1" 主机信息 域名 + 端口
hostname: "localhost" 主机地址(IP地址) || 域名
href 完整的地址
port: 端口
pathname: 路径
protocol: "http"||"https" 协议
# hash 代表了 # 后边跟随的是hash
? search 代表了 ?后边跟随的内容, form表单中input提交的name值,如?wd=开课吧 (get方式提交过来的数据)

hash # 后边跟随的是hash
路由(routing): 根据路径决定前端显示的视图
hashchange 监听 location 中的 hash 变化
hash路由实现原理

href 完整的地址栏信息

replace 替换地址栏信息

reload 刷新

网友评论