<rich-text :selectable="true" :nodes="decodedText"></rich-text> const encodedText = '<img src="https://zhxkj-1309150347.cos.ap-guangzhou.myqcloud.com/mall/detail/20221229162213_8539.jpg" alt="" /><img src="https://zhxkj-1309150347.cos.ap-guangzhou.myqcloud.com/mall/detail/20221229162223_7062.jpg" alt="" /&g'; const decodedText = encodedText.replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/&/g, '&'); //把拿到的图片自适应 .replace(/\<img/gi, '<img style="width:100%;height:auto" ') .replace(/style="text-wrap: wrap;"/gi, '') console.log(decodedText);
标签:encodedText,编码,JS,解码,replace,文本 From: https://www.cnblogs.com/bshit/p/17600820.html