在我的 node_modules 中,我添加了引导程序的依赖项,它允许我获取 dropdown.js。但是当我进入使用下拉菜单的页面时,当我单击下拉按钮时,它在开发模式下不起作用,并返回以下错误:
dropdown.js:186 Uncaught TypeError: u is not a constructor
at c.t.show (dropdown.js:186)
at c.t.toggle (dropdown.js:137)
at HTMLButtonElement.<anonymous> (dropdown.js:375)
at Function.each (jquery.js:367)
at jQuery.fn.init.each (jquery.js:202)
at jQuery.fn.init.c._jQueryInterface [as dropdown] (dropdown.js:362)
at HTMLButtonElement.<anonymous> (dropdown.js:528)
at HTMLDocument.dispatch (jquery.js:5237)
at HTMLDocument.elemData.handle (jquery.js:5044)
Run Code Online (Sandbox Code Playgroud)
此 dropdown.js 文件中的相关行如下:
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
Run Code Online (Sandbox Code Playgroud)
“波普尔不是构造函数。”
我试过这个:
this._popper = Popper.createElement(referenceElement, this._menu, this._getPopperConfig());
Run Code Online (Sandbox Code Playgroud)
但它仍然无法正常工作。
奇怪的是,我只在开发模式中遇到这个错误,在生产中没有。
这是整个文件 dropdown.js 的链接,但我不确定它会有所帮助: