wxml:
<rich-text nodes='{{newsDetail.content}}' class='content'></rich-text>
js:
http.post(postdata).then(res => {
console.log(res);
wx.hideLoading();
if (res.data.code === '0000') {
// 将img宽度100%; 高度自适应
res.data.data.content = res.data.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
this.setData({
newsDetail: res.data.data
})
} else {
console.log(res.data.msg);
}