使用element-ui遇到的一些问题

一、table组件固定页滚动条缩放时断裂问题

在这里插入图片描述解决方式
监听窗口缩放事件,使用doLayout方法重绘,再加个防抖
代码示例

 mounted() {
    this.antiShake = this.shakeProof(this.dropDowwn, 500)
    window.onresize = () => {
      this.antiShake()
    }
  },
methods: {
    shakeProof(antiShake, delay) {
      let timer
      return function(args) {
        clearInterval(timer)
        timer = setTimeout(() => {
          this.$refs.orderList.doLayout()
        }, delay)
      }
    },
 }

二、table合计行自定义代码、tooltip 组件content使用slot引入到html结构中

合计行时table组件自动生成的,页面中时没有代码可以改的,不过开发可以在合计行赋值时使用方法将html引入到页面中。
代码示例

 sums[index] = (() => {
            const content = this.$capitalizationAmount(this.order_price)
            const data = this.order_price
            const el = <el-tooltip id='total-dark' class='item' effect='dark' placement='top-start'>
              <span id='total-Summaries'>{data}</span>
              <div slot='content' id='total-slot'>
                {content}
              </div>
            </el-tooltip>
            return el
          })()
          return

三、 Upload 文件缩略图类型不支持删除

element中上传组件中有个文件缩略图的类型,和其他类型不一样,其他的可以直接删除,这个需要自己手动删除,那么这就有个问题file-list这个是不支持双向绑定的,也就是说,想要直接在这里面去掉删除项是不行的。但是可以从uploadFiles中获得上传图片。
代码示例

 handleRemove(file) {
      const fileList = this.$refs.upload.uploadFiles
      const index = fileList.findIndex(fileItem => {
        return fileItem.uid === file.uid
      })
      fileList.splice(index, 1)
      this.params.media.splice(index, 1)
    },

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值