我正在尝试使用新的文件 API 对输入文件进行排序。它返回的列表似乎是不可变的:
var x = "";
var files = e.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
files.sort();
> Uncaught TypeError: Object #<FileList> has no method 'sort'
如果我想一次读入多个文件,但我希望它们按顺序到达。 (A.csv
在 B.csv
之前处理,等等)。这可以实现吗?
最佳答案
[].slice.call(files)
把它做成一个真正的数组,然后你可以在上面使用.sort
。
关于javascript - 对 FileList 对象进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16020593/