有时候直接复制文章内容或者直接手敲,在回显的时候却无法正常展示空格,解决方法如下:
<rich-text :nodes="reportList.exercisePrescription" class="rich-text"></rich-text>
.rich-text{
white-space: pre-wrap;
}
在 Vue 的 v-html 指令中,通过添加 white-space: pre-wrap 可保留服务端返回的换行符和空格。
其余属性值的对比:
有时候直接复制文章内容或者直接手敲,在回显的时候却无法正常展示空格,解决方法如下:
<rich-text :nodes="reportList.exercisePrescription" class="rich-text"></rich-text>
.rich-text{
white-space: pre-wrap;
}
在 Vue 的 v-html 指令中,通过添加 white-space: pre-wrap 可保留服务端返回的换行符和空格。
其余属性值的对比: