1.对于后台返回的数据中含有html标签需要解析成html标签
数据格式:
str = "<p>你好></p>"
方法一:在html中解析(使用v-html):
<p v-html="str">{{str}}</p>
方法二:使用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;
}
网友评论