无法将项目拖动到输入字段

时间:2017-12-04 16:44:20

标签: javascript jquery ember.js

我在我的ember-app中使用了ember drag drop plugin:“ember install ember-drag-drop” 将项目从一个地方拖到另一个地方,但我无法进入输入字段。

这是我的代码:

{{#draggable-object content=systemVariableInfo dragStartAction='myStartAction' dragEndAction='myEndAction'}}                    
{{item.name}}   
{{/draggable-object}}

控制器::

myStartAction: function(content) {
        console.log("content"+content);
     //Content is the same as the content parameter set above
    },
    myEndAction: function(content) {
      //Content is the same as the content parameter set above
    },  

如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

您必须将目标放入draggable-object-target

<div>
    {{#each items as |item|}}
    {{#draggable-object content=item}}                    
      {{item.name}}
    {{/draggable-object}}
    {{/each}}
</div>
<br>
<form>
{{#draggable-object-target action="onDrop"}}
  {{input type="text" placeholder="drop here" value=inputValue}}
{{/draggable-object-target}}
</form>

请参阅Ember-Twiddle