修复 upload 当打开文件选择框并点击取消后,导致文件上传失效的问题

pull/1309/head^2
贤心 2023-07-26 17:31:12 +08:00
parent 92465e0a29
commit 34d05cfae3
1 changed files with 3 additions and 0 deletions

View File

@ -588,8 +588,11 @@ layui.define(['lay','layer'], function(exports){
that.elemFile.off('upload.change').on('upload.change', function(){ that.elemFile.off('upload.change').on('upload.change', function(){
var files = this.files || []; var files = this.files || [];
if(files.length === 0) return;
extendAttrs.call(this); extendAttrs.call(this);
setChooseFile(files); setChooseFile(files);
options.auto ? that.upload() : setChooseText(files); // 是否自动触发上传 options.auto ? that.upload() : setChooseText(files); // 是否自动触发上传
}); });