1.html 识别不了 ‘\n’,只要在结果所在的标签设置css样式:
white-space: pre-line;
2.使用replace将\n替换换为标签
str.replace(/\n/g, '<br>');
后台返回数据\n识别换行
最新推荐文章于 2024-05-08 11:44:15 发布
1.html 识别不了 ‘\n’,只要在结果所在的标签设置css样式:
white-space: pre-line;
2.使用replace将\n替换换为标签
str.replace(/\n/g, '<br>');