后台返回数据有\n识别为换行
2021-03-16 本文已影响0人
陶菇凉
1.html 识别不了 ‘\n’,只要在结果所在的标签设置css样式:
white-space: pre-line;
2.使用replace将\n替换换为标签
str.replace(/\n/g, '<br>');
1.html 识别不了 ‘\n’,只要在结果所在的标签设置css样式:
white-space: pre-line;
2.使用replace将\n替换换为标签
str.replace(/\n/g, '<br>');