React
来源:互联网 发布:ps淘宝店招尺寸怎么改 编辑:程序博客网 时间:2024/06/03 08:17
使用Anit Design
根据样式选择复制代码。
注意执行 export default Form.create()(TestPage);
跳转方式一
// 跳转主页面 window.location.href = '/';
前提在路由里定义
跳转方式二
browserHistory.push('/select-identity');
同样是需要路由配置
部分二级路由需要携带参数例如ID等
跳转方式三
<a href="./Register">register now!</a>
React动态生成view示例
根据接口数据生成view
.then((json) => { // console.log(json); const matchCompanysOptions = json.map((company) => { return <li key={company.id}><img src={company.logoUrl} alt={company.id}/></li>; }); this.setState({matchCompanysOptions}); })
数组???的循环遍历
.then((json) => { // console.log(json); const matchExportsOptions = []; for (let i = 0; i < (json.length % 2 === 0 ? json.length : json.length - 1); i += 2) { const matchExportsOption = (<Carousel.Item key={i}> <div className="home-experts-Carousel-item-content"> <div className="home-experts-Carousel-item-content-left"> <a href={`experts/experts-details/${json[i].id}`} className="item-img-link" data-id="131889"> <img width={276} height={280} alt="" src={json[i].avatarUrl} /> </a> <div> <a href={`experts/experts-details/${json[i].id}`} className="item-title-link" data-id="131889"> <h2 className="home-experts-content-title">{json[i].realName}</h2> </a> <p className="home-experts-content">{json[i].profile} </p> </div> </div> <div className="home-experts-Carousel-item-content-right"> <a href={`experts/experts-details/${json[i + 1].id}`} className="item-img-link" data-id="131889"> <img width={276} height={280} alt="" src={json[i + 1].avatarUrl} /> </a> <div> <a href={`experts/experts-details/${json[i + 1].id}`} className="item-title-link" data-id="131889"> <h2 className="home-experts-content-title">{json[i + 1].realName}</h2> </a> <p className="home-experts-content">{json[i + 1].profile} </p> </div> </div> </div> </Carousel.Item>); matchExportsOptions.push(matchExportsOption); } this.setState({ matchExportsOptions, }); })
引用动态view
<Carousel className="home-experts-Carousel" prevLabel="" nextLabel="" indicators={false} prevIcon={<span className="home-experts-arrow-left" />} nextIcon={<span className="home-experts-arrow-right" />} > {this.state.matchExportsOptions} </Carousel>
阅读全文
0 0
- React
- react
- React
- REACT
- React
- react
- react
- React
- react
- react
- React
- React
- react
- React
- react
- react
- React
- React
- Comparator的自定义排序
- leetcode 547. Friend Circles
- Android动态加载之简单加载模式
- ubuntu14.04批量处理图片命令
- JSP开发中的MVC分层设计
- React
- 安装DirectX SDK时出现Error Code:s1023 的解决方案
- 安卓角标的适配问题
- 算法分析课每周练习 Regular Expression Matching
- 我的个人站点搭建 框架选择
- Win10下配置Apache+php
- 《Effective C++》第二章:构造/析构/赋值运算
- 微服务(Microservices)【翻译】
- 【OPNET学习系列文章之2】两个固定节点通信