Taro框架组件中的RichText
-
如果富文本中有图片,确不能给图片的宽度设置成100%,建议修复这个BUG(注:在H5中没事)
-
我这边都是让后台返回数据时带上style 前端就不用处理了
-
小程序的话,是小程序自己的行为,这个没啥办法
-
@小田
用正则就可以自己处理this.setState({
content:<div class="news-rick-container">${data.data.content .replace(/!important/g, '') .replace(/<img[^>]*>/gi, function(match, capture) { return match.replace(/style\s*?=\s*?([‘"])[\s\S]*?\1/gi, 'style="max-width:100%;height:auto;"'); // 替换style })}
,
subject: data.data.subject,
time: data.data.published_at
});