vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

Syntax for default message in custom template

Open gilles6 opened this issue 7 years ago • 10 comments

What is the correct syntax to change the default message in a custom template ?

This one doesn't work: <div class="dz-message" data-dz-message><span>Your Custom Message</span></div>

gilles6 avatar Mar 30 '18 07:03 gilles6

Have you tried using any of the language settings in your options object?

Can you post a fuller snippet?

rowanwins avatar Mar 30 '18 09:03 rowanwins

It works fine with language settings in my options but I need to change the CSS of this message, that's why I'm trying to put it in my template.

methods: {
    template: function() {
        return `
            <div class="dz-preview dz-file-preview col-4 p-1 m-0 d-flex align-items-center" style="background-color: transparent;">
                <div class="dz-message"><span data-dz-message>===把图片拖放这里===</span></div>
                <img data-dz-thumbnail class="img-fluid rounded"></img>
                <div class="dz-details">
                    <div class="dz-filename"><span data-dz-name></span></div>
                    <div class="dz-size" data-dz-size></div>
                </div>
                <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
                <div class="dz-success-mark"><i class=""fa fa-check></i></div>
                <div class="dz-error-mark"><i class=""fa fa-close></i></div>
                <div class="dz-error-message"><span data-dz-errormessage></span></div>
            </div>`;
    },
}

The div with dz-message class is not displaying anything, other divs work fine.

gilles6 avatar Mar 31 '18 02:03 gilles6

Sorry for the slow reply, can you create a mockup of what you are trying to achieve @devondahon , I'm having a bit of trouble understanding what you want to do?

rowanwins avatar Apr 26 '18 00:04 rowanwins

@devondahon Did you resolved your issue?

vrajroham avatar May 22 '18 14:05 vrajroham

@rowanwins he means this message (default message / dictDefaultMessage) : image image

disappears when a custom template is used (previewTemplate) and looks like this: image image

briefly, if we use "previewTemplate" the default message is not rendering. I have the same problem btw!

@devondahon @vrajroham you have to use the class: "dropzone" in the parent container.

jomedinna avatar Jul 26 '18 17:07 jomedinna

+1 . Anyone able to solve this? @jomedinna @rowanwins @devondahon

boka18 avatar Aug 10 '18 15:08 boka18

@boka18 u need its works for me. you need to define dz-default dz-message in the html of the form, not in the template <form action="/file-upload" class="dropzone dz-clickable" id="uploadImageForm"><div class="dz-default dz-message "><span>Drop files here to uploassd</span></div></form>

noe23 avatar Mar 31 '19 01:03 noe23

Anyone have any info on this? @boka18 @jomedinna @rowanwins @devondahon

I am running into an issue, while using useCustomSlot and previewTemplate().

I have to set useCustomSlot to false after adding the file to fix it, but I'm wondering if this is the correct way to use these together? I am only testing this stuff out without a live endpoint now. I will want to be able to add progress, and messaging along the way for the user, but it is feeling hard to manipulate the previewTemplate at this point.

expectation

..a custom error message is one need, for instance.

jordanboston avatar May 30 '19 21:05 jordanboston

Setting the default message with a custom template is actually in the official docs, but took me a while to find it: https://rowanwins.github.io/vue-dropzone/docs/dist/#/custom-html

Hope that helps someone else, or future me.

johncarter- avatar Aug 02 '19 10:08 johncarter-

@johncarter- bro you save me :D ty

haba-sensei avatar Feb 07 '22 11:02 haba-sensei