小编Cam*_*UET的帖子

dropdown.js:186 Uncaught TypeError: 当我点击下拉按钮时,你不是一个返回的构造函数

在我的 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 的链接,但我不确定它会有所帮助:

下拉菜单

javascript constructor bootstrap-4

11
推荐指数
2
解决办法
8145
查看次数

标签 统计

bootstrap-4 ×1

constructor ×1

javascript ×1