laravel 做后端,vue做前端,后端返回数据的字符串中含有 <br/> 或 \n \r\n 等换行符,在前端页面无法正常渲染出换行效果,尝试用str.replace方法无效,最终找到解决办法 解决办法 给包含换行符的字符串元素增加css white-space:pre-wrap 附上 white-space 的定义用法以及可能的值 官网- https://www.w3school.com.cn/cssref/pr_text_white-space.asp