<td>{this.handleCalcObjectDesc(data)}</td>
handleCalcObjectDesc = (data) => {
return data.replace(/<br\/?>/g, '\n').split('\n').map((line, index) => (
<p key={index} className="nowrap">
{line}
</p>
));
};
.nowrap {
white-space: nowrap;
width: 100%;
}
需求:将字符串中的<br/>去除并进行换行