我正在使用Meteor-Dragula。让我们说我将一个包含字符串Slide
的容器拖到hello
DOM元素中。我如何访问该字符串?比如说,将其推入String数组中。
也许我已经走上了正确的道路?
#right
答案 0 :(得分:1)
我认为你不能使用Meteor事件Meteor-Dragula。相反,您需要使用 drake.on
才能注册事件侦听器。例如:
x = [];
Template.dragulaTemplate.onRendered(function() {
var drake = dragula([document.querySelector('#left1'), document.querySelector('#right1')]);
drake.on('drop', function(el, target, source, sibling) {
x.push($(el).text());
console.log(x);
});
});