1.對於后台返回的數據中含有html標簽需要解析成html格式
數據格式:
str = "<p>親愛的250。</p><p>你好。</p><p><br/></p>"
在html中解析:
<p v-html="str">{{str}}</p>
2.使用pre標簽
<pre>{{str}}<pre>
樣式white-space: pre-line 加上才會換行
.weekyContent pre{ font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", Arial, sans-serif; line-height: 28px; font-size: 16px; white-space: pre-line; margin: 0; }