我正在寻找一个dropzone.js
事件,该事件会在下拉结束之后和上传之前提升。
我需要的是一次访问有关已删除文件的所有信息,而不是逐个文件,因此addedfile
事件不是一个选项。
我认为dragend
事件是合适的,但是当我放下我的dropzone中的文件时它不会被触发。
我正在使用的代码片段如下所示:
Dropzone.options.myDropzone = {
// Prevents Dropzone from uploading dropped files immediately
autoProcessQueue : false,
dictDefaultMessage: "Drop files or click here to upload a new DICOM series ...",
init : function() {
myDropzone = this;
//Restore initial message when queue has been completed
this.on("dragend", function(file) {
console.log("ondragend");
});
}
};
我错过了什么吗?为此目的,dropzone.js
中是否还有其他事件?
答案 0 :(得分:2)
如果您想要对drop事件进行回调,则应使用' drop'。在这种情况下,请查看'文件'阵列。但请注意,如果用户点击dropzone并从那里选择文件,则不会触发此事件。
Dropzone.options.MyDropzone = {
autoProcessQueue : false,
dictDefaultMessage: "Drop files or click here to upload a new DICOM series ...",
init : function() {
myDropzone = this;
//Restore initial message when queue has been completed
this.on("drop", function(event) {
console.log(myDropzone.files);
});
}
};
请参阅此小提琴,例如:jsfiddle.net/qqkbzv5a/2/
答案 1 :(得分:1)
有一个名为addedfiles
的未记录事件,该事件将在“拖放”和手动文件选择上触发。
this.on("addedfiles", function(files) {
console.log(files.length + ' files added');
});
答案 2 :(得分:0)
最后,我使用了let cal = NSCalendar.currentCalendar()
let comps = NSDateComponents()
comps.hour = 10
comps.weekday = cal.firstWeekday
let now = NSDate()
let fireDate = cal.nextDateAfterDate(now, matchingComponents: comps, options: [.MatchNextTimePreservingSmallerUnits])!
事件,该事件响应dropzone上的drop和click操作。
selectedfiles