前端防止xxs

const prevent = str => {
return str.replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g, "&quot;").replace(/'/g, "&#039;");
};
原文地址:https://www.cnblogs.com/QxkWeb/p/9003434.html