Vue-dropzone: hide file preview on file drag

Created on 22 Nov 2017  路  9Comments  路  Source: rowanwins/vue-dropzone

Hi @rowanwins
I want to hide file preview when user drag and drop files on dropzone.
I'm using $(".dz-preview").hide(); to hide preview. It works when user add files by clicking on dropzone but not in case of drag-drop.

awaiting feedback

Most helpful comment

I used the following options to remove previews from a dropzone (the key being previewsContainer: false); Vue is used to generate a list of actionable items via v-on:vdropzone-file-added="someListBuildingFunction", which allows some flexibility for the ui.

dropOptions: { url: "/api/upload/", dictDefaultMessage: '<i class="fas fa-cloud-upload-alt fa-3x" style="color:green"></i>', previewsContainer: false, autoProcessQueue: false }

All 9 comments

@gerryats When are you calling .hide()? On event vdropzone-file-added?

yes on vdropzone-file-added
I tried it on vdropzone-drop event too, but it didn't work

Hi @gerryats

Would it make more sense to use a custom preview template? If you dont want the user to see anything just set it to an empty div perhaps...

I tried to do that too but then it shows only remove, cancel upload links.

So what exactly do you want to show @gerryats ?

As per your last suggestion I returned the empty div. But it still shows the cancel/remove file link.
please see the screenshot attached. How can I removed this?

screen shot 2018-02-02 at 2 22 36 pm

What happens if you set addRemoveLinks: false in the dropzone options object?

setting addRemoveLinks to false worked.
How do I persist my default dict message when file is added through drag-drop. I've put this code $(".dz-message").show(); in fileAdded () method. But its not displaying me anything.

I used the following options to remove previews from a dropzone (the key being previewsContainer: false); Vue is used to generate a list of actionable items via v-on:vdropzone-file-added="someListBuildingFunction", which allows some flexibility for the ui.

dropOptions: { url: "/api/upload/", dictDefaultMessage: '<i class="fas fa-cloud-upload-alt fa-3x" style="color:green"></i>', previewsContainer: false, autoProcessQueue: false }

Was this page helpful?
0 / 5 - 0 ratings