This commit is contained in:
yumoqing 2025-09-28 16:06:20 +08:00
parent fb7ceb2e35
commit 30a3050c4c

View File

@ -519,15 +519,16 @@ bricks.UiFile = class extends bricks.VBox {
this.set_css('hover', true); this.set_css('hover', true);
var files = []; var files = [];
for (const f of event.dataTransfer.files) { for (const f of event.dataTransfer.files) {
if (this.opts.accept && f.type.startsWith(this.opts.accept)){ if (this.opts.accept && ! f.type.startsWith(this.opts.accept)){
files.push(f); continue;
} }
files.push(f);
}; };
if (this.opts.multiple){ if (this.opts.multiple){
this.value = files; this.value = files;
this.set_input_file(files); this.set_input_file(files);
} else { } else {
this.value = file[0]; this.value = files[0];
this.set_input_file([this.value]); this.set_input_file([this.value]);
} }
this.dispatch('changed', this.value); this.dispatch('changed', this.value);