方法1:直接在外层容器设置css属性,white-space:pre-wrap 方法2:换行符在js中用\r\n表示,拿到文字内容,使用字符串的replace方法全局替换即可,string.replace(/\r\n/g,'</br>')