老师下图的推荐作者用push方法,内容该怎么改
来源:7-14 热门搜索换页功能实现
半夜丶有狗叫
2018-10-23
import React, { PureComponent } from “react”;
import { WriterWrapper, WriterAuthor, WriterItem, WrterLoge } from “…/style”;
import { connect } from “react-redux”;
import { getWriter } from “…/store/actionCreator”;
class Writer extends PureComponent {
getPageList() {
const { page, list } = this.props;
const newList=list.toJS();
const pageList=[];
for (let i = (page - 1) * 5; i < page * 5; i++) {
return( pageList.push(
{/* 这边的src,key的内容该怎么改 */}
{newList[i].userName}
{newList[i].title}
+关注
)
)
}
}
render() {
const { handleClick} = this.props;
return (
推荐作者
换一批
{this.getPageList()}
);
}
}
const mapState = state => ({
list: state.getIn([“home”, “wriList”]),
page: state.getIn([“home”, “Page”]),
totalPage: state.getIn([“home”, “totalPage”])
});
const mapDispatch = dispatch => {
return dispatch(getWriter());
};
export default connect(
mapState,
mapDispatch
)(Writer);
1回答
-
Dell
2018-10-26
能用简单的语言描述清楚你的问题是什么吗?如果你获取到10条,只想显示5条,循环的时候》5的时候return null就可以了
012018-10-26
相似问题