如何使聚合物元素可拖动

Mar*_*kob 10 dart polymer dart-polymer

我正在尝试在自定义聚合物元素上拖放HTML5,但它不起作用.没有聚合物,可以只添加draggable属性.

这是我在Dart中的代码:

my_component.html

<polymer-element name="my-component">
  <template>
    <style>
      @host {
        :scope {
          display: block;
        }
      }
      div {
        background-color: red;
        width: 200px;
        height: 200px;
      }
    </style>
    <div>
      Drag me
    </div>
  </template>
  <script type="application/dart" src="my_component.dart"></script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)

my_component.dart

import 'package:polymer/polymer.dart';

@CustomTag('my-component')
class MyComponent extends PolymerElement {
  MyComponent.created() : super.created();
}
Run Code Online (Sandbox Code Playgroud)

的test.html

<!DOCTYPE html>

<html>
  <head>
    <link rel="import" href="my_component.html">

    <script type="application/dart">import 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
  </head>
  <body>
    <my-component draggable="true"></my-component>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我也尝试直接从HTML元素扩展.这也不起作用.

有关聚合物元素如何可拖动的任何想法?

编辑:有一个错误报告.

Gle*_*nna 1

为了使我的聚合物元素可拖动,我使用了 JS 库Draggabilly,在我的例子中,聚合物组件也在网格中,所以我将它与Packery结合使用