引导程序 5 下拉列表无法使用 Angular13 打开



嘿,伙计们,我正在做一个有角度的项目,并使用bootstrap 5。我想实现一个下拉多选,但不幸的是下拉列表没有扩展。

我以这个例子为例:用Angular和Bootstrap 5 创建多选下拉菜单

我创建了一个stackblitz示例:https://stackblitz.com/edit/github-va1hpx?

希望有人能帮忙。

固定

问题是在这个例子中使用了引导程序5的alpha版本,而我使用的是5.1.3。在那段时间里,bootstrap对按钮等应该添加哪些类进行了一些更改。所以你应该写

这个:

<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-haspopup="true"

而不是这个:

<button class="btn dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"

其他html元素也应该得到特定的类,比如保证金类

ms-1 ms-2 ....

在输入元件上

所以在我的情况下,添加不是问题

jQuery.js or popper.js

到我的angular.json,就像其他线程中提到的那样:https://stackoverflow.com/search?tab=Relevance&页面大小=30&q=popper.js%20bootstrap&s=144706d6-c9be-4120-b105-c37f2b848352

它只是默认的引导程序5类。

最新更新