如何自动化 angular-拖放列表
How to automate angular-drag-and-drop-lists
问题: 尝试在使用 angular-拖放列表 (go to detailed description)[=14= 的前端模拟拖放]
尝试过:
1.jquery-模拟:给出以下错误
Uncaught TypeError: Failed to execute 'dispatchEvent' on
'EventTarget': parameter 1 is not of type 'Event'.
2.drag-drop-helper.js : 单击发生在要拖动的项目上
3.drag_to : 什么都没发生
需要更多建议。
谢谢
jquery-模拟:https://github.com/jquery/jquery-simulate
抱歉无法 post link drag_to 和拖放-helper.js
自定义事件需要这样调整:
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent", {"cancelable": true})
event.initCustomEvent(type, true, true, null);
event.dataTransfer = {
data: {
},
setData: function(type,val) {
this.data[type] = val
this.types[0] = type
}
getData: function(type) {
return this.data[type]
},
dropEffect: 'move',
effectAllowed:'move',
types: [],
items: {},
files:{}
}
return event
}
在 native js drag drop script 然后它工作正常
问题: 尝试在使用 angular-拖放列表 (go to detailed description)[=14= 的前端模拟拖放]
尝试过:
1.jquery-模拟:给出以下错误
Uncaught TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.
2.drag-drop-helper.js : 单击发生在要拖动的项目上
3.drag_to : 什么都没发生
需要更多建议。
谢谢
jquery-模拟:https://github.com/jquery/jquery-simulate
抱歉无法 post link drag_to 和拖放-helper.js
自定义事件需要这样调整:
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent", {"cancelable": true})
event.initCustomEvent(type, true, true, null);
event.dataTransfer = {
data: {
},
setData: function(type,val) {
this.data[type] = val
this.types[0] = type
}
getData: function(type) {
return this.data[type]
},
dropEffect: 'move',
effectAllowed:'move',
types: [],
items: {},
files:{}
}
return event
}
在 native js drag drop script 然后它工作正常