lian-yue / vue-upload-component

Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter
Apache License 2.0
2.69k stars 697 forks source link

shift() new file instead of push() to files array #423

Closed lucianobosco closed 2 years ago

lucianobosco commented 2 years ago

Most of the media managers attach the last uploaded image at the beginning of the media library. Right now, once a file is added, the file is pushed to the end of files[]. So if you add 2 images (A and B) and later add 2 more images (C and D) the array result is files = [A, B, C, D] It would be very nice to have the choice of pushing or shifting the latest added element in order to have the results as files = [A, B, C, D] or files = [D, C, B, A]

If anyone has any advice about how to accomplish this right now, it will be really appreciated/

lucianobosco commented 2 years ago

Please ignore me, as soon I posted this I found that using addIndex: true, solves the issue. Not sure if that property if for this purpose, but it works for me so far.