reacet-router跳转页面的方法总结
来源:互联网 发布:ee源码网 编辑:程序博客网 时间:2024/06/05 10:13
通过Link标签跳转
Link标签相当于原生js中的a标签,用法基本类似。to属性相当于a标签中的href。
<Link to="/login">点击跳转到登录页面</Link>
通过this.props.history.pushState跳转
this.props.history.pushState({passParam: true}, "/targetURL");
第一个参数为跳转页面时,需传递的参数,若不需要传参数,则为null。
第二个参数为跳转的目标页面。
使用browserHistory.push
const path = `/login/${userName}`browserHistory.push(path)
使用context对象。
使用不同的方法创建对象时,使用context的方法也不尽相同。
export default React.createClass({ contextTypes: { router: React.PropTypes.object }, handleSubmit(event) { // ... this.context.router.push(path) },})
class Demo extends Component{ static contextTypes = { router: React.PropTypes.object.isRequired }; go(id) { const {router}= this.context; router.push(`/project?id=${id}`); } }
0 0
- reacet-router跳转页面的方法总结
- vue-router跳转页面
- vue-router跳转页面
- 页面跳转方法总结
- 页面跳转方法总结
- JSP页面跳转的方法总结
- JSP页面跳转的方法总结
- JSP页面跳转的方法总结
- JS跳转页面的方法总结
- 总结一些页面常见的跳转方法
- React页面利用this.context.router.push跳转传参的接收方法
- js中页面刷新和页面跳转的方法总结
- React-Router传参取值页面跳转
- 使用 vue-router 跳转页面
- 使用vue-router页面跳转
- 页面跳转方法总结大全
- 页面跳转实现方法总结
- 页面跳转方法总结大全
- [GDI+] 基于GDIPlus的文本特效渲染:打字效果
- nginx安装php和php-fpm
- 【bzoj 1497】[NOI2006]最大获利
- meta标签<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>等
- iOS8的一些好玩的升级
- reacet-router跳转页面的方法总结
- 解决python 提示 SyntaxError: Missing parentheses in call to 'print'
- WAMPServerVersion 3.0.6
- ACM进阶计划
- 用CSS做文字向上移动的轮播
- Synchronized 与 Lock的区别
- 数据结构(线性表):单循环链表
- MyBatis集成log4j简单配置
- 乱码终极解决大全(阅尽天下A片,心中便无码)