接口返回的内容如下:有空格有换行,但 使用v-html无效
![](https://img-blog.csdnimg.cn/direct/ab9b57a3b951456f8850aa23833b62f0.png)
需加css样式 white-space: pre-wrap;
javascript
<div class="pretty-html" v-html="Value"></div>
.pretty-html {
white-space: pre-wrap; /* 保留空格和换行,并允许自动换行 */
}
不生效
![](https://img-blog.csdnimg.cn/direct/4bb2c93c146147fab8e689d58bbcd578.png)
加了white-space后
![](https://img-blog.csdnimg.cn/direct/5c27e7e6188c4017b43b767c247b33c4.png)