可能原因:组件会缓存上次的上传历史,若是同一文件就不处理
具体原因:待查
解决方法:在choose里面增加如下语句“uploadListIns.config.elem.next()[0].value = '' ”
var uploadListIns = upload.render({ elem: '#FileUpload', elemList: $('#FileList'), // 列表元素对象 accept: 'file', multiple: false, number: 3, auto: false, bindAction: '#Save', choose: function (obj) { // 读取本地文件 obj.preview(function (index, file, result) { //清空 input file 值,以免同名文件选择后不可再选 uploadListIns.config.elem.next()[0].value = ''; }) })
注:此句也可放置在choose内的起始位置
var uploadListIns = upload.render({ elem: '#FileUpload', elemList: $('#FileList'), // 列表元素对象 accept: 'file', multiple: false, number: 3, auto: false, bindAction: '#Save', choose: function (obj) { //清空 input file 值,以免同名文件选择后不可再选 uploadListIns.config.elem.next()[0].value = ''; // 读取本地文件 obj.preview(function (index, file, result) { }) })
标签:function,false,uploadListIns,LayUI,Upload,elem,choose,file,上传 From: https://www.cnblogs.com/sugarwxx/p/18357359