React + antd table of contents of each column wrap

1, FIG effect as 

 

 

 

2, separated array split ( ",") 

3, the following detailed code Code 

const leadsDetails = this.props.leadsDetails;
const audits = JSON.stringify(leadsDetails) !== '[]' ? leadsDetails.audits : [];

const auditsColumns = [
{
title: 'Creation Time' ,
dataIndex: 'created_at',
key: 'created_at',
},
{
title: 'user' ,
dataIndex: 'user',
key: 'user',
},
{
title: 'content' ,
dataIndex: 'content',
key: 'content',
render: (text, record) =>{
let contentStr;
let br=<br></br>;
let result=null;
for(let i=0;i<audits.length;i++){
let contentStr=audits[i].content;
contentStr=text.toString().split(",");
if(contentStr.length<2){
return text;
}
for(let j=0;j<contentStr.length;j++){
if(j==0){
result=contentStr[j];
}else{
result=<span>{result}{br}{contentStr[j]}</span>;
}
}
return <div>{result}</div>;
}
},
},

 


 
----------------
Disclaimer: This article is CSDN blogger "Little Red 5 students' original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/xh_960125/article/details/89309547

Guess you like

Origin www.cnblogs.com/ygunoil/p/12364891.html