我正在使用这个库 Drop ,但是记录很差,我不明白如何使用它。 首先我安装了:
npm install tether-drop
我已经下载了 Drop.js,然后用 Tether 导入它(导入所有内容):
require('../../node_modules/tether/dist/js/tether.min');
require('../../node_modules/tether-drop/dist/js/drop.min');
require('../third_party/drop-master/dist/js/drop.min');
,但是当我尝试时:
let dropInstance = new Drop({
target: document.querySelector('.dropTarget'),
content: 'Welcome to the future',
classes: 'drop-theme-arrows',
position: 'bottom left',
openOn: 'click'
});
它说:
Uncaught ReferenceError: Drop is not defined
我正在使用 Laravel - 5.8,它使用 Elixir 和 GULP(我猜)。
我错过了什么?
最佳答案
嗨,我仍然无法发表评论,但请尝试这种方式
const { Drop } = require('tether-drop');
或
const Drop = require('tether-drop');
取决于其在模块上的导出方式
关于javascript - Hubspot drop.js - Uncaught ReferenceError : Drop is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56807570/