在你的项目当中安装即可
npm i xss-filters -S
npm i xss-filters-es6 -S
如果你想在全局中挂载
main.js部分
import { inHTMLData,uriInUnQuotedAttr } from "xss-filters-es6";
const xssFilters = require('xss-filters');
Vue.prototype.$inHTMLData = inHTMLData;
vue.prototype.$uriInUnQuotedAttr = uriInUnQuotedAttr;
view部分
let mess = {
value:xssFilters.inHTMLData(this.value),
value:this.$inHTMLData(this.value)
}
console.log(mess)
上面的二选一 即可
import { inHTMLData, uriInUnQuotedAttr } from "xss-filters-es6";
return `<a style="color: #b374ff" href="${uriInUnQuotedAttr(
url
)}" target="_blank">${uriInUnQuotedAttr(url)}</a>`;
过滤掉一些url跳转的