使用 polyfill 和通过 angular.json 的 Angular 加载引导程序

问题描述

我正在使用带有 bootstrap 5 的最新 Angular。我想基于 bootstrap 类创建一个自定义下拉列表。

new window.bootstrap.Dropdown() 是在 de code 中的 typescript 类中调用生成新的 bootstrap dropdown 实例。

window.bootstrap 实例由 polyfill 设置。

polyfills.ts

import * as bs from 'bootstrap/dist/js/bootstrap.bundle.js';

declare global {
  interface Window {
    bootstrapp: any;
  }
}

window.bootstrapp = bs;

某些模板使用折叠选项。当我使用 polyfill 时,它看起来像是正常的引导程序实例损坏了。

示例:

  • 没有活动的 polyfill,我可以折叠和展开 div。
  • 使用 polyfill,我可以折叠,但展开 div 不起作用。没有任何错误

有人可以解释我如何解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)