gpt4 book ai didi

javascript - 如何将 Dragula 与 Googlepolymer 结合使用

转载 作者:行者123 更新时间:2023-11-27 23:39:45 26 4
gpt4 key购买 nike

我正在使用 Google Polymer 创建一个 html 模块。我正在尝试拖放一个自定义 polymer 元素,因此我无法在 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。我在这里遗漏了什么或做得不正确吗?

编辑:我所做的导入如下:

dragula.js/dist/dragula.js

dragula.js/dist/dragula.css

最佳答案

为了获得 polymer 元件内的容器,您不能使用

document.querySelector('.leftTable')

相反,您必须使用

this.$.leftTable

它通过 id 来选择。

关于javascript - 如何将 Dragula 与 Googlepolymer 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33783745/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com