如何在Bootstrap 5中使用JavaScript初始化敬酒?

问题描述

我无法初始化Bootstrap 5吐司。

初始化吐司的按钮:

<button type="button" class="btn btn-primary" id="toastbtn">Initialize toast</button>

我的JavaScript:

document.getElementById("toastbtn").onclick = function() {
        var toastElList = [].slice.call(document.querySelectorAll('.toast'))
        var toastList = toastElList.map(function(toastEl) {
          return new bootstrap.Toast(toastEl,option)
        })
      };

JSfiddle:https://jsfiddle.net/5e1t3scp/

还有here's the documentation

JavaScript已从Bootstrap的网站上获取。我尝试了很多次,但无法初始化。我究竟做错了什么?预先感谢!

解决方法

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

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

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