How to automate angular-drag-and-drop-lists

后端 未结 1 911
粉色の甜心
粉色の甜心 2020-12-22 12:14

Problem : trying to simulate drag drop in frontend that uses angular-drag-and-drop-lists (go to detailed description)

Tried :

相关标签:
1条回答
  • 2020-12-22 13:08

    Custom event needed to adjusted like this :

      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
    }
    

    in native js drag drop script and then it works fine

    0 讨论(0)
提交回复
热议问题