gpt4 book ai didi

javascript - Dropzone.js - 在排队文件长度 > 0 上显示按钮

转载 作者:行者123 更新时间:2023-12-03 05:10:16 28 4
gpt4 key购买 nike

我是 Dropzone.js 的新手,我想知道当我在列表中添加或删除新文件时是否有办法显示“处理”按钮。这是代码:

HTML:

<div id="dropz" class="dropzone">
<button type="button" class="btn btn-info pull-right" id="uploadFiles" style="display:none">Upload</button>
</div>

JQuery:

Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("#dropz", {
url: "@Url.Action("AddFiles")",
addRemoveLinks: true,
autoProcessQueue: false,
maxFiles: 5,
parallelUploads: 5,
init: function() {
this.on("addedfile", function (file) {
//Here is what i tried, but the alert result is undefined
if (myDropzone.getQueuedFiles().lenght > 0)
alert(myDropzone.getQueuedFiles().lenght);
$('#uploadFiles').css('display','block');
});
}
});

$('#uploadFiles').on('click', function () {
myDropzone.processQueue();
});

最佳答案

拼写错误的单词lenghtlength,使用控制台进行调试:

if (myDropzone.getQueuedFiles().length > 0) {
console.log(myDropzone.getQueuedFiles().length);
$('#uploadFiles').css('display','block');
}

关于javascript - Dropzone.js - 在排队文件长度 > 0 上显示按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41852491/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com