File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,10 @@ export default {
137137 type: String ,
138138 required: true
139139 },
140+ urlFactory: {
141+ type: Function ,
142+ required: false
143+ },
140144 additionalFields: {
141145 type: Array ,
142146 default : () => []
@@ -308,15 +312,21 @@ export default {
308312 reject (xhr)
309313 }
310314
311- xhr .open (this .method , this .url , true )
312- if (this .headers ) {
313- Object .keys (this .headers ).forEach (key => {
314- xhr .setRequestHeader (key, this .headers [key])
315- })
316- }
315+ const resolver = this .urlFactory
316+ ? this .urlFactory (file)
317+ : Promise .resolve (this .url )
317318
318- this .xhrs .push (xhr)
319- xhr .send (form)
319+ resolver .then (url => {
320+ xhr .open (this .method , url, true )
321+ if (this .headers ) {
322+ Object .keys (this .headers ).forEach (key => {
323+ xhr .setRequestHeader (key, this .headers [key])
324+ })
325+ }
326+
327+ this .xhrs .push (xhr)
328+ xhr .send (form)
329+ })
320330 })
321331 },
322332 upload () {
You can’t perform that action at this time.
0 commit comments