// 去除富文本的标签只获得文本内容
export function removeTag (str) {
let fn_result = str;
fn_result = fn_result.replace(/(↵)/g, "");
// fn_result = fn_result.replace(/\s*|\t|\r|\n/g, "");// 去除tab、空格、空行(会去掉图片和字体颜色样式)
fn_result = fn_result.replace(/( )/g, "");
fn_result = fn_result.replace("<html><head><title></title></head><body>", "");
fn_result = fn_result.replace("</body></html>", "");
console.log(fn_result.length)
return fn_result;
};
js 去除富文本
最新推荐文章于 2024-06-20 12:00:26 发布