テキストデータ
変更前の効果
解決
通常のルールを使用してデータ内の img タグのクラスを定義するか、スタイルを直接記述して
から js ファイル内のデータを変更します
data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ') //正则替换
または
that.setData({
content: res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto"')
})
或
that.setData({
content: res.data.contents.replace('<img ', '<img style="max-width:100%;height:auto"')
})
最終効果