获取富文本里图片的src路径
作者:
贺大大i | 来源:发表于
2022-07-21 16:36 被阅读0次 getUrl(str) {
const reg =
/(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g;
str = str.match(reg);
if (str && str.length > 0) {
return str[0];
}
return null;
},
//调用
this.imgUrl= this.getUrl(富文本内容)
如何将富文本里图片的width替换成100%?
this.content = res.data.topicList.content.replace(/\<img/gi, '<img style=width:100%;height:auto')
富文本内容.replace(/\<img/gi, '<img style=width:100%;height:auto')
本文标题:获取富文本里图片的src路径
本文链接:https://www.haomeiwen.com/subject/vquuirtx.html
网友评论