
react-history
我是一个粉刷匠呀
这个作者很懒,什么都没留下…
展开
-
history方法的传值与取值
传值history.push( pathname: url + id, query: { type: 'test' }, state: { ...obj })取值pathname传值通过this.props.paramsquery传值通过this.props.location.querystate传值通过this.props.location.state原创 2021-07-05 16:14:33 · 1120 阅读 · 1 评论 -
react中的history(push,go,replace)切换路由方法的区别
1.history.pushhistory.push方法更改当前路由,会向当前路由栈里面添加一条新的记录,跳转后点击回退可回退到当前页面2.history.replacehistory.replace方法更改当前路由,不会向当前路由栈里面添加一条新的记录,跳转后点击回退不可回退到当前页面,与他的名字一样,是直接替换当前路由3.history.gohistory.go方法与window.history.go()类似,参数为整数,表示向前或向后跳转...原创 2021-06-17 16:22:05 · 6024 阅读 · 0 评论