单个页面中的多个 Dropzone [英] Multiple Dropzone in a single page
本文介绍了单个页面中的多个 Dropzone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 Dropzone 时没有创建 dropzone 表单.这种方式对我很有用.
I'm using Dropzone without creating a dropzone form. It works great for me in this way.
但在这种情况下,我无法在我的页面中创建另一个 Dropzone 实例.
But in this case I can not create another instance of Dropzone in my page.
var myDropzone1 = new Dropzone(
document.body,
{
url : "upload1"...
.
.
. some parameters
};
var myDropzone2 = new Dropzone(
document.body,
{
url : "upload'"...
.
.
. some parameters
};
当我执行此操作时,我收到错误 Dropzone 已附加.
When I do this, I'm getting the error Dropzone already attached.
推荐答案
这是可能的,但是您不能像以前那样在同一元素上绑定第二个 dropdzone.2 Dropzones 在一个元素上是没有意义的.2x document.body 在您的解决方案 atm 中.试试这个...
It's possible, but you can't bind a second dropdzone on the same element, as you did. 2 Dropzones on one element makes no sense. 2x document.body in your solution atm. Try this...
HTML:
<form action="/file-upload" class="dropzone" id="a-form-element"></form>
<form action="/file-upload" class="dropzone" id="an-other-form-element"></form>
JavaScript:
JavaScript:
var myDropzoneTheFirst = new Dropzone(
//id of drop zone element 1
'#a-form-element', {
url : "uploadUrl/1"
}
);
var myDropzoneTheSecond = new Dropzone(
//id of drop zone element 2
'#an-other-form-element', {
url : "uploadUrl/2"
}
);
这篇关于单个页面中的多个 Dropzone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文