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

IE11遇到情况如下:

å¨è¿éæå¥å¾çæè¿°

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)

猜你喜欢

转载自blog.csdn.net/u011121176/article/details/93762362
今日推荐