react url传参持续化(刷新页面参数不消失)

react web项目,页面刷新url的参数不消失react

一、安装 query-string
npm i -save-dev query-stringweb

二、点击按钮跳转页面:
this.props.history.push({
pathname: '/g6',
search:`?id=${id}&name=${name}`
});npm

三、g6页面获取参数:
let {id,name} = querystring.parse(this.props.location.search)this

相关文章
相关标签/搜索