码迷,mamicode.com
首页 > 编程语言 > 详细

IE 导入 EXCEL 的 readExcelIE() 方法,处理对象数组中有不存在值的对象元素的方案

时间:2019-07-30 12:38:31      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:code   wrapper   const   fine   check   attr   reac   ota   -o   

IE11遇到情况如下:

技术图片技术图片?

技术图片技术图片?

经过如此强大的.filter(item => item != null)处理之后:

技术图片技术图片?

完美!!!

IE导入EXCEL的readExcelIE方法,遇到这个鬼SHI大坑处理方法:
关键是这段代码:.filter(item => item != null),因为IE11大佬测试起来很卡,笔记本都发烫了蓝瘦香菇。。。搞了一晚终于可用纪念一哈。。。

for (let i of this.arrObj) {
    // if ([...Object.values(i)].filter(item => typeof item !== ‘undefined‘).length) {
    if ([...Object.values(i)].filter(item => item != null).length) {
        const _dataRow = {}
        this.arrCheckAll.forEach(item => { _dataRow[item[‘key‘]] = i[item[this.browser]] })
        this.infoTable.push(_dataRow)
    }
}

// this.arrObj = this.arrObj.filter(itemA => [...Object.values(itemA)].filter(itemB => typeof itemB !== ‘undefined‘).length > 0)
this.arrObj = this.arrObj.filter(itemA => [...Object.values(itemA)].filter(itemB => itemB != null).length > 0)

 

技术图片

IE 导入 EXCEL 的 readExcelIE() 方法,处理对象数组中有不存在值的对象元素的方案

标签:code   wrapper   const   fine   check   attr   reac   ota   -o   

原文地址:https://www.cnblogs.com/wen233/p/11269244.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!