##前言
最近公司老大要我们前端入一下react的门,就学起react来了
##路由传参的实现步奏:
-
在路由表中
<Router> <div> <div className='headerStyle'> <p><Link to="/">电影</Link></p> <p><input type='text' placeholder='请输入搜索的内容'></input><img src={searchImg} alt='111'/></p> </div> <Route exact path="/" component={Index} /> <Route exact path="/more/:url" component={More} /> //这里写上url参数 </div> </Router>
-
路由式导航与编程式导航
2.1 html的Link标签中return <span><Link to={"/more/"+ props.url}>更多></Link></span>;
2.2 编程式导航
this.props.history.push(‘path’+参数);
注意: 编程时导航不