import AutoResponsive from "autoresponsive-react";
componentDidMount() {
this.setState({
containerWidth: (document.body.clientWidth || document.documentElement.clientWidth) - 322
});
}
getAutoResponsiveProps = () => {
return {
itemMargin: 10,
containerWidth: this.state.containerWidth,
itemClassName: 'productListItem',
gridWidth: 20,
transitionDuration: '.5'
};
};
<AutoResponsive {...this.getAutoResponsiveProps()}>
{
data.map((item, index) => {
const {height, width, path} = item._350;
let heights = (item.cmtStar > 0 || item.cmtCount > 0) ? 124 : 88;
return (
<ul key={item.object_id} style={{width: 286, height: (286 * height / width) + heights}} className="productListItem pr">
<li>todo 你想要展示的内容</li>
</ul>)
})
}
</AutoResponsive>