File tree 1 file changed +9
-14
lines changed
1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -183,23 +183,18 @@ export default {
183
183
setFiles ( files ) {
184
184
if ( ! files ) {
185
185
this . selectedFile = null
186
- return
187
- }
188
- if ( ! this . multiple ) {
189
- let firstElement = files [ 0 ]
190
- if ( firstElement . type . match ( this . accept ) ) {
191
- this . selectedFile = firstElement
192
- }
193
- return
194
- }
195
- // Convert files to array
196
- const filesArray = [ ]
197
- for ( let i = 0 ; i < files . length ; i ++ ) {
198
- if ( files [ i ] . type . match ( this . accept ) ) {
186
+ } else if ( this . multiple ) {
187
+ // Convert files to array
188
+ const filesArray = [ ]
189
+ for ( let i = 0 ; i < files . length ; i ++ ) {
199
190
filesArray . push ( files [ i ] )
200
191
}
192
+ // Return file(s) as array
193
+ this . selectedFile = filesArray
194
+ } else {
195
+ // Return single file object
196
+ this . selectedFile = files [ 0 ]
201
197
}
202
- this . selectedFile = filesArray
203
198
} ,
204
199
dragover ( evt ) {
205
200
evt . preventDefault ( )
You can’t perform that action at this time.
0 commit comments