前端日常杂记

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"

5 table 分页选择, 保留上一页选择的项,圈出来的项必填

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值