页面点击本地页面打开新页面
1 2 3 4
| <Button style={{backgroundColor:'#F0F2F5'}} onClick={()=>{window.location.href="https://baidu.com"}} className="r-button" >
|
引入import {Link} from ‘react-router-dom’
1 2 3
| <Link to="/new/login/"> <Button className="e-button" type="primary">Back to login page</Button> </Link>
|
带参跳转 引入import { Link} from ‘umi’;
1 2 3
| <Link to={{pathname:`/device/enroll-record?account=${row.account}`}} target="_blank"> <Button className="enroll_btn" size="small" >打卡记录</Button> </Link>
|
页面参数获取:this.props.location.query.account
注意:target=”_blank” 表示新打开一个窗口跳转,传参时必须使用?拼接参数
如果不使用target=”_blank” 表示本页面跳转
1
| to={{pathname:'/device/enroll-record‘,query:{account:row.account}}}
|
本地页面不变跳转到新的页面
1 2 3 4 5 6 7 8 9
| <Button style={{backgroundColor:'#F0F2F5'}} onClick={this.handle} className="last-button" >
handle=()=>{ const w=window.open('about:blank'); w.location.href="www.baidu.com" }
|
history.push() 跳转
1
| this.props.history.push(url)
|