后端返回字符串中带换行符,前端需转换
let remarkStr =' ' remarkStr = remarkStr.replace(/\n/g,"<br/>") this.remark = remarkStr
<span v-html="remark"></span>
另外原生参考方法:
https://www.itranslater.com/qa/details/2106874997112308736
https://segmentfault.com/a/1190000003936301
https://www.cnblogs.com/jinbang/p/6790592.html