```javascript this.$api.appPlateForm('', 'index/goodsdetail', params, function(res) { if (res.code == 200) { let content = res.data.goods.content; let re = /<img [^>]*src=['"]([^'"]+)[^>]*>/gi; let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i // 匹配图片中的src let reHttp = new RegExp("http"); let imgArr = content.match(re); for (let i = 0; i < imgArr.length; i++) { let imgSrc = imgArr[i].match(srcReg); if (!reHttp.test(imgSrc[1])) { content = content.replaceAll(imgSrc[1], that.hostUrl+imgSrc[1]); } } that.goods_detail = content.replaceAll('<img', '<img style=max-width:100%') }