用了这个插件: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>