博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
react-router
阅读量:6944 次
发布时间:2019-06-27

本文共 1177 字,大约阅读时间需要 3 分钟。

1、window.location当前页面地址信息
属性:
href url完整地址
hash 路由,#开始的部分
search 查询部分,?开始的url
host 主机名及端口号
hostname 主机名
pathname url路径部分
方法:
replace() 替换
reload() 重新加载
如:http://172.16.87.204:8900/?s=1#/invoiceLottery/lotteryRecord?ss=22href: "http://172.16.87.204:8900/?s=1#/invoiceLottery/lotteryRecord?ss=22"hash: "#/invoiceLottery/lotteryRecord?ss=22"search: "?s=1"host: "172.16.87.204:8900"hostname: "172.16.87.204"pathname: "/"

 

2、浏览器history(浏览器历史记录)

history.back(); // 返回上级 (history.go(-1))history.forward(); // 跳转到下个页面(history.go(1))history.go(); // 用于指定页跳转

 

3、react的history对象
 
history改造的浏览器history(单页面hash改变加载不同内容)
history.location // 当前页面所在位置history.push({ pathname: '/new-place' }); // 路由跳转history.replace({ pathname: '/new-place' }); // 路由跳转(覆盖式)history.goBack(); // 返回上一个页面history.goForward(); // 跳转下一个页面history.go(); // 用于指定页跳转history.listen(); // 监听地址变化,执行相关操作

 

4、react-router是建立在history对象之上
一个history知道如何去监听浏览器地址栏的变化,并解析这个URL转换为location对象,
然后router使用它匹配到路由,最后正确地渲染对应组件

 

5、dva中dva-router使用routerRedux跳转路由
routerRedux.push();routerRedux.replace();routerRedux.goBack(); // 返回上一级路由(会刷新页面)// model里面使用yield put(routerRedux.goBack());

 

转载于:https://www.cnblogs.com/alisadream/p/10185196.html

你可能感兴趣的文章
SQL Server 2012 AlwaysOn高可用配置之五:配置仲裁
查看>>
Powershell管理系列(三十九)PowerShell查询和解锁AD账号
查看>>
【实战虚拟化】安全设计之一基本架构
查看>>
LINUX下查看CPU负载的vmstat命令
查看>>
linux里shell中的test代表的意义
查看>>
【VMCloud云平台】SCOM配置(六)-应用深度监控
查看>>
解析linux下磁盘乱序的问题
查看>>
Excel图表之道一突破常规
查看>>
是什么浪费了我工作的时间
查看>>
四大超能力加持,京东家电双11效率致胜
查看>>
关于Golang语言的web编程的实例及常见问题
查看>>
JDK5.0新特性(2)-注解(Annotation)
查看>>
C# 中的委托和事件
查看>>
代替Runas,自动输入密码
查看>>
老师的斐波那契数列算法
查看>>
AutoLISP图像控件Image应用示例
查看>>
MVVM中的命令绑定及命令参数
查看>>
动态加载JS脚本【转】
查看>>
单元测试
查看>>
ORALCE存储之ROWID
查看>>