簡體   English   中英

Popper,Bootstrap 4和ES2015:未定義Popper

[英]Popper, Bootstrap 4 and ES2015: Popper not defined

我對如何使Bootstrap 4中的Javascript實用程序感到困惑。

我正在使用ES2015樣式要求。 我已經使用節點模塊安裝了jQuery,Bootstrap 4(beta 2)和Popper.js的最新Beta。 這是我加載JS的方法:

window.$ = window.jQuery = require('jquery');

$(function() {

  require('popper');
  require('./vendor/bootstrap/index');

});

Popper的文檔指出,您需要這樣的代碼來實例化Popper:

  var reference = document.querySelector('#dropdownLanguageButton');
  var popper = document.querySelector('div[aria-labelledby="dropdownLanguageButton"]');
  var anotherPopper = new Popper(
      reference,
      popper,
      {
          // popper options here
      }
  );

但是,尚不清楚是否需要實例化Bootstrap下拉列表等簡單內容。

Bootstrap 4文檔中沒有明確的示例。

我得到的錯誤是index.js:10 Uncaught ReferenceError: Popper is not defined

幫助贊賞!

可能是popper.js的路徑問題。 Popper的必需文件位於“ node_modules / popper.js / dist / umd / popper.min.js”中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM