render函数中实现for循环

2019-11-11  本文已影响0人  Vivian_0430

map方法(table中图片数组回显)

{
  title: "整改完成图片/附件",
  align: "center",
  dataIndex: "photo",
  customRender: (text, record, index) => {
    const srcList = record.photos;
    const style = {
       width: "50px",
       height: "50px"
    };
    let content = srcList.map((item, index) => {
                           return (
                              <div>
                                <img src={item} style={style} />
                              </div>
                            );
                         });
    const obj = {
      children: content,
      attrs: { colSpan: 1 }
     };
    return obj;
  },
}
上一篇下一篇

猜你喜欢

热点阅读