1.html 识别不了 ‘\n’,只要在结果所在的标签设置css样式: white-space: pre-line; 2.使用replace将\n替换换为标签 str.replace(/\n/g, '<br>');