方法1 《刷新页面参数会消失》 <Link className="item" to={{pathname:'/order',params:{index :"3"}}}> <i className="icon iconfont icon-shangpingouwudai2"></i> <p>售后</p> </Link> 方法2 《刷新页面参数会消失》 <div className="item" onClick={this.go_order.bind(this,index)}> <i className="icon iconfont icon-shangpingouwudai2"></i> <p>测试</p> </div> go_order(index){ this.props.history.push({pathname:"/order",params:{index :index}}); }
方法3 《刷新页面参数还在》 <Route path="/order/:index" component={Order} /> <Link className="item" to={{pathname:'/order/'+0}}> <i className="icon iconfont icon-shangpingouwudai2"></i> <p>待付款</p> </Link> 方法4 《刷新页面参数还在》 <Route path="/order/:index" component={Order} /> <div className="item" onClick={this.go_order.bind(this,index)}> <i className="icon iconfont icon-shangpingouwudai2"></i> <p>测试</p> </div> go_order(index){ this.props.history.push("/order/"+index); }