1 iframe 宽高由内容撑开
<iframe
src="http://URL_HERE.html"
style="height:200px;width:100%;border:none;overflow:hidden;"
onload='javascript:(function(o){
o.style.height =o.contentWindow.document.body.scrollHeight+"px";
}(this));'
>
</iframe>
2 防注入代码
Vue.prototype.$sanitize = function sanitizeHTML (html) {
return xss(html, {
onIgnoreTagAttr: function (tag, name, value, isWhiteAttr) {
if (name.substr(0, 5) === 'class') {
// 通过内置的escapeAttrValue函数来对属性值进行转义
return name + '="' + xss.escapeAttrValue(value) + '"'
}
if (name.substr(0, 5) === 'style') {
return name + '="' + xss.escapeAttrValue(value) + '"'
}
},
onIgnoreTag: function (tag, html, options) {
if (tag.substr(0, 9) === 'highlight') {
// 不对其属性列表进行过滤
return html
}
}
})
}
3 el-transfer 清空搜索框关键字
this.$refs.transferUsers.$children[0]._data.queryStr = ''
this.$refs.transferUsers.$children[3]._data.queryStr = ''
4 el-popover 上使用 loading
:loading="loading" 无效,需要写为 v-loading="loading"