折叠不能在IE11上工作

折叠不能在IE11上工作

本文介绍了折叠不能在IE11上工作(Object.keys:参数不是对象)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可折叠(隐藏和显示数据)在其他浏览器(opera,chrome)中工作正常。但是来到IE onclick (在公司上如图所示)数据正在显示(扩展),Onclick在相同的标签/按钮(公司)数据没有隐藏。在控制台错误显示为 Object.keys:参数不是对象

Collapsible(to hide and show data) is working fine in other browsers(opera,chrome).But coming to IE onclick(on company as shown in figure) data is showing (expanding) ,Onclick on same tag/button(company) data is not hiding.In console error is showings as Object.keys: argument is not an Object

我发现相关问题但不适用于我的代码(didn不帮我。
请帮帮我解决这个问题?

I found related question Object.keys not working in internet Explorer here but not applicable to my code(didn't help me).Please help me, to solve this?

提前致谢。

推荐答案

由于这是用bootstrap-4标记的,我假设它与,其中所有可折叠内容在IE11中都无法使用。

As this is tagged with "bootstrap-4" I'm assuming it's related to this bug in Bootstrap 4.1.0 where all collapsibles were unclosable in IE11.

更具体地说,它是Bootstraps中的第334行 js / src / collapse.js 导致问题。它改成了从
... typeof config ==='object'&& config to

... typeof config ==='object'&&配置? config:{}




引用:
如果config不是对象,则为false。在IE中,Object.keys(false)会导致错误,而现代浏览器返回[]




该错误在后续版本中得到修复。我最近在一个项目中遇到了同样的问题,将Bootstrap更新到4.1.1版修复了这个问题。


(更新package.json与bootstrap:v4.1.1(或更高版本)并运行 npm install 。)




More specifically, it was line 334 in Bootstraps js/src/collapse.js that was causing the problem. It was changed from
...typeof config === 'object' && config to
...typeof config === 'object' && config ? config : {}

Quoting this page:"If config is not an object, this is false. In IE, Object.keys(false) results in an error, while modern browsers return []"

The bug was fixed in subsequent versions. I had the same problem in a project recently and updating Bootstrap to version 4.1.1 fixed the problem.
(Update package.json with "bootstrap": "v4.1.1"(or later) and run npm install.)

这篇关于折叠不能在IE11上工作(Object.keys:参数不是对象)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:08