File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 70
70
},
71
71
data () {
72
72
return {
73
+ response: null ,
73
74
paused: false ,
74
75
error: false ,
75
76
averageSpeed: 0 ,
139
140
},
140
141
statusText () {
141
142
const status = this .status
142
- return this .file .uploader .fileStatusText [status] || status
143
+ const fileStatusText = this .file .uploader .fileStatusText
144
+ let txt = status
145
+ if (typeof fileStatusText === ' function' ) {
146
+ txt = fileStatusText (status, this .response )
147
+ } else {
148
+ txt = fileStatusText[status]
149
+ }
150
+ return txt || status
143
151
},
144
152
formatedTimeRemaining () {
145
153
const timeRemaining = this .timeRemaining
189
197
this .file .retry ()
190
198
this ._actionCheck ()
191
199
},
200
+ processResponse (message ) {
201
+ let res = message
202
+ try {
203
+ res = JSON .parse (message)
204
+ } catch (e) {}
205
+ this .response = res
206
+ },
192
207
fileEventsHandler (event , args ) {
193
208
const rootFile = args[0 ]
194
209
const file = args[1 ]
195
210
const target = this .list ? rootFile : file
196
211
if (this .file === target) {
197
212
if (this .list && event === ' fileSuccess' ) {
213
+ this .processResponse (args[2 ])
198
214
return
199
215
}
200
216
this [` _${ event } ` ].apply (this , args)
208
224
this .uploadedSize = this .file .sizeUploaded ()
209
225
this ._actionCheck ()
210
226
},
211
- _fileSuccess () {
227
+ _fileSuccess (rootFile , file , message ) {
228
+ if (rootFile) {
229
+ this .processResponse (message)
230
+ }
212
231
this ._fileProgress ()
213
232
this .error = false
214
233
this .isComplete = true
Original file line number Diff line number Diff line change 46
46
default: true
47
47
},
48
48
fileStatusText: {
49
- type: Object ,
49
+ type: [ Object , Function ] ,
50
50
default () {
51
51
return {
52
52
success: ' success' ,
You can’t perform that action at this time.
0 commit comments