按理说使用v-html转译富文本数据,html标签就没了,但有时候还是有
方法一
HTMLDecode(text) {
var temp = document.createElement("div");
temp.innerHTML = text;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
},
方法二
HTMLDecode(str) {
return str
.replace(str ? /&(?!#?\w+;)/g : /&/g, '&')
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, "\"")
.replace(/'/g, "\'");
},