从富文本编辑器输入内容,然后前端通过接口获取到的这些内容会自带很多html标签

var content;
         var s = "";
         if(str.length == 0) return "";
         s = datas[i].content.replace(/&/g,"&");
         s = s.replace(/</g,"<");
         s = s.replace(/>/g,">");
         s = s.replace(/ /g," ");
         s = s.replace(/'/g,"\'");
         s = s.replace(/"/g,"\"");
         var textstr =s.replace(/<[^>]*>|/g,"")

解决方法链接:https://blog.csdn.net/wujiangwei567/article/details/41051225

你可能感兴趣的:(从富文本编辑器输入内容,然后前端通过接口获取到的这些内容会自带很多html标签)