加上正则表达式就行了,
this.commentContent是正常进行双向绑定的值
this.commentContent.replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi,‘‘).replace(/<[^>]+?>/g,‘‘).replace(/\s+/g,‘ ‘).replace(/ /g,‘ ‘).replace(/>/g,‘ ‘)
原文:https://www.cnblogs.com/gfbzs/p/12447270.html