File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
src/components/base/upload-imgs Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -526,20 +526,10 @@ export default {
526
526
// 如果是用户自定义方法
527
527
// 出于简化 api 的考虑, 只允许单个文件上传
528
528
if (this .remoteFuc ) {
529
- // promise 模式
530
- if (this .remoteFuc .then ) {
531
- const remoteData = await this .remoteFuc (item .file )
532
- reduceResult (item, remoteData)
533
- if (! remoteData) {
534
- return false
535
- }
536
- return item
537
- }
538
-
539
529
// 回调函数模式
540
530
if (typeof this .remoteFuc === ' function' ) {
541
531
return new Promise ((resolve ) => {
542
- this .remoteFuc (item .file , (data ) => {
532
+ const a = this .remoteFuc (item .file , (data ) => {
543
533
reduceResult (item, data)
544
534
if (! data) {
545
535
this .$message .error (' 执行自定义上传出错' )
@@ -548,6 +538,16 @@ export default {
548
538
resolve (item)
549
539
}
550
540
})
541
+ // promise 模式
542
+ if (a != null && typeof a .then === ' function' ) {
543
+ a .then ((remoteData ) => {
544
+ reduceResult (item, remoteData)
545
+ if (! remoteData) {
546
+ resolve (false )
547
+ }
548
+ resolve (item)
549
+ })
550
+ }
551
551
})
552
552
}
553
553
You can’t perform that action at this time.
0 commit comments