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