1、在JS中我们获取数据,在没有类名的情况下
使用正则匹配你想要添加演示的节点
res[1].data[0].f_content为rich-text里面的节点
如图
代码:让获取的节点中的图片的最大宽度为100%,高度为auto
this.content = res[1].data[0].f_content.replace(/\<img/gi, '<img style="width:100%";height:auto')
初始状态:图片超过div

效果:

微信小程序 rich-text富文本框 怎么设置里面节点的样式
阅读 56
2023-07-02
使用正则匹配你想要添加演示的节点
res[1].data[0].f_content为rich-text里面的节点
如图
代码:让获取的节点中的图片的最大宽度为100%,高度为auto
this.content = res[1].data[0].f_content.replace(/\<img/gi, '<img style="width:100%";height:auto')
初始状态:图片超过div

效果:

相关推荐
精彩评论(0)