版权声明:个人发声,博客技术文章都是本人项目工程经验积累,转载请注明!(物联网云平台全站设计师-承接软硬件设计、微信、web前端、Java后台、云平台搭建项目,请联系微信:28775855,邮件:[email protected]) https://blog.csdn.net/phlr5/article/details/84023218
控件拖拽问题(一)
assemble_page.vue,把draggableControls保存在state.dragableControls中,别忘了在assemble_page.vue中是调用了Control控件,调用的dragableControls。
这个Control控件在Control.vue文件中:
mounted(){
this. el.setAttribute(‘draggable’, true)
this. el.ondrag = onDrag
this.$el.ondragend = onDragEnd
}
注册了拖拽函数,但是发现onDragEnd不响应,我们在看一下dnd.js文件的initDropEvents:
function initDropEvents(drag) {
drag.ondragenter = onDragEnter
drag.ondragover = onDragOver
drag.ondrop = onDrop
drag.ondragleave = onDragLeave
}
这个函数注册了拖拽释放的处理函数,而initDropEvents函数在bind函数调用并注册的。
这个bind函数,又让我晕了,不知道什么时候用,在深入程序