如何将 dragula 与 Google 聚合物一起使用

How to use dragula with Google polymer

我正在使用 Google Polymer 创建一个 html 模块。我正在尝试拖放一个属于自定义聚合物元素的元素,因此我无法在 HTML 5 中使用可拖动标签。因此,我使用的是 Dragula https://github.com/bevacqua/dragula 。我的 html 看起来像这样

<div class="leftTable">
    <custom-polymer-element></custom-polymer-element>
</div>

在 Polymer 函数中,我使用我希望能够从中拖动的容器调用 dragula:

<script>
    Polymer({
        is:"custom-wrapper",
        attatched: function() {
            dragula([document.querySelector('.leftTable')]);
        }
    });
</script>

我在 demo/index.html 文件中导入了 dragula。有没有我遗漏或做错了什么?

编辑:我做的导入如下:

德拉古拉.js/dist/dragula.js

德拉古拉.js/dist/dragula.css

为了在聚合物元素中获得容器,您不能使用

document.querySelector('.leftTable')

您必须使用

this.$.leftTable

改为按 id 选择。