From 4f44edad47e32a792000e1f7cf96a10798ec5f25 Mon Sep 17 00:00:00 2001 From: Anthony Kinsey Date: Thu, 23 Sep 2021 14:34:21 -1000 Subject: [PATCH] feat: initial implementation of basic drag and drop for upload --- src/components/images/ImageUploader.vue | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/components/images/ImageUploader.vue b/src/components/images/ImageUploader.vue index a0502099..568c66a2 100644 --- a/src/components/images/ImageUploader.vue +++ b/src/components/images/ImageUploader.vue @@ -1,6 +1,6 @@ @@ -21,6 +21,8 @@ export default { emit('upload-error', null) // clear previous errors let files = e.target.files || e.dataTransfer.files + if (!files.length) return + console.log(e.target.files) let images = [] for (var i = 0; i < files.length; i++) { let file = files[i] @@ -186,6 +188,32 @@ export default { // emit('upload-error') // } + // var cancelEvent = function(e) { + // e.stopPropagation(); + // e.preventDefault(); + // }; + + // var removeDrag = function(e) { + // e.stopPropagation(); + // e.preventDefault(); + // }; + + // var dropEvent = function(e) { + // removeDrag(e); + // uploadFile(e) + // }; + + // $parent.on('dragenter', cancelEvent); + // $parent.on('dragover', cancelEvent); + // $dragZone.on('dragenter', cancelEvent); + // $dragZone.on('dragover', cancelEvent); + // $dragZone.on('dragend', removeDrag); + // $dragZone.on('dragexit', removeDrag); + // $dragZone.on('dragleave', removeDrag); + + // $parent.on('drop', dropEvent); + // $dragZone.on('drop', dropEvent); + const v = reactive({ fileInput: null, multiple: !props.purpose,