小程序修改富文本中图片行内样式
//移除旧的样式
let html = data.goods_desc.replace(/<img[^>]*>/gi, (match, capture)=> {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
return match;
});
//再设置新的样式
html = html.replace(/\<img/gi, '<img style="width:100%;display:inherit;height:auto;text-align:center;"');