js获取富文本中所有的图片地址
富文本内容
转换代码
getImgSrc(richtext) {
let imgList = [];
richtext.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, (match, capture) => { //match表示img元素,capture表示img地址
imgList.push(capture);
});
return imgList;
}
getImgSrc(richtext) {
let imgList = [];
richtext.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, (match, capture) => { //match表示img元素,capture表示img地址
imgList.push(capture);
});
return imgList;
}