用了这个插件:https://jsxss.com/zh/index.html
github地址:https://github.com/leizongmin/js-xss

import axios from ‘axios’
import store from ‘@/store/index’
import md5 from ‘md5’
import xss from ‘xss’
import { _encryptPhone, isEmojiStr } from ‘./common’
import loadMap from ‘…/utils/loadMap.js’
// Vue.component('Calendar', Vue.extend(CalendarComponent));
// Vue.prototype.$echarts = echarts;
Vue.prototype.$loadMap = loadMap;
Vue.prototype.$xss = xss
Vue.prototype.goUrl = function (url) {
this.$router.push(url);
};
template内容调整:
<p v-else><i v-html="$xss(it.content)"></i></p>
这篇博客介绍了如何利用js-xss库在Vue项目中进行XSS过滤,保护应用安全。作者展示了引入和使用js-xss插件的代码,并修改了Vue模板内容,确保不安全的HTML内容能被正确处理。
&spm=1001.2101.3001.5002&articleId=115263939&d=1&t=3&u=797026e78ec447989f0651af48b7258d)
798

被折叠的 条评论
为什么被折叠?



