替换富文本中 img标签的src地址
imgSrcReplace(htmlstr) {
let regex3 = new RegExp(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi);
let htmlstr1 = htmlstr.replace(regex3, function(match, capture) {
// capture 为你匹配到的地址
// localtionPath 为你想要拼接的地址
let newStr = '<img src=' + localtionPath + capture + ' alt="" />';
return newStr;
});
regex3 = null;
return htmlstr1;
},
浙公网安备 33010602011771号