const removeHtmlStyle =(html :any)=> {
let relStyle = /style\s*?=\s*?([‘"])[\s\S]*?\1/g;
//去除样式
let relTag = /<.+?>/g;
//去除标签
let relClass = /class\s*?=\s*?([‘"])[\s\S]*?\1/g;
// 清除类名 let newHtml = "";
if (html) {
newHtml = html.replace(relStyle, "");
newHtml = newHtml.replace(relTag, '');
newHtml = newHtml.replace(relClass, '');
}
return newHtml;
};
标签:vue,标签,replace,正则,html,let,newHtml,去除 From: https://www.cnblogs.com/web-chuanfa/p/17333579.html