问题描述
在 Angular 9 中(使用Bootstrap 4和Jquery 3.5.1).单击引导程序折叠按钮时,在浏览器控制台上出现错误,而不是下拉菜单.
In Angular 9 (using Bootstrap 4 and Jquery 3.5.1). when clicking on bootstrap collapse button, I am getting an error on my browser console instead of a dropdown menu.
我真的不知道错误的确切来源.
I really don't know where exactly the error came from.
Can't convert object to primitive value(zone-evergreen:171).
Uncaught Type Error: Cannot convert object to primitive value(zone-evergreen.js:171 )
at RegExp.test (<anonymous>)
at HTMLDivElement.<anonymous> (bootstrap.bundle.min.js:6)
at Function.each (jquery.min.js:2)
at S.fn.init.each (jquery.min.js:2)
at S.fn.init.a._jQueryInterface [as collapse] (bootstrap.bundle.min.js:6)
at HTMLDivElement.<anonymous> (bootstrap.bundle.min.js:6)
at Function.each (jquery.min.js:2)
at S.fn.init.each (jquery.min.js:2)
at HTMLButtonElement.<anonymous> (bootstrap.bundle.min.js:6)
at HTMLDocument.dispatch (jquery.min.js:2)
推荐答案
此问题似乎与jQuery 3.5.0有关.这是一个重大变化,影响了许多插件.暂时恢复为jQuery的早期版本(如3.4.1)可以为我解决此问题.
This issue seems to be related to jQuery 3.5.0. It is a breaking change that affects many plugins. Temporarily reverting to a previous version of jQuery (like 3.4.1) fixed the issue for me.
来源: jQuery版本#4665
更新:
jQuery 3.5.1恢复了重大更改,应该可以安全使用.
jQuery 3.5.1 reverts the breaking change and should be safe to use.
Announcement: jQuery 3.5.1 Released: Fixing a Regression
这篇关于未捕获的TypeError:无法将对象转换为原始值(zone-evergreen.js:171)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!