标签:div npm html pre bsp tps har return value
1.在终端引入xss,命令:
npm install xss --save
2.在vue的页面进行引入
import xss from ‘xss‘
测试
<p v-html="test"></p> export default { data () { return { test: `<a onclick=‘alert("xss攻击")‘>链接</a>` }
// 有弹框
<p v-html="$xss(test)"></p> import xss from ‘xss‘ export default { data () { return { test: `<a onclick=‘alert("xss攻击")‘>链接</a>` } } Object.defineProperty(Vue.prototype, ‘$xss‘, { value: xss })
// click事件被过滤
原文 https://blog.csdn.net/qiumen/article/details/88119275
标签:div npm html pre bsp tps har return value
原文地址:https://www.cnblogs.com/1032473245jing/p/11929277.html