File tree Expand file tree Collapse file tree
src/components/base/upload-imgs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -526,20 +526,10 @@ export default {
526526 // 如果是用户自定义方法
527527 // 出于简化 api 的考虑, 只允许单个文件上传
528528 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-
539529 // 回调函数模式
540530 if (typeof this .remoteFuc === ' function' ) {
541531 return new Promise ((resolve ) => {
542- this .remoteFuc (item .file , (data ) => {
532+ const a = this .remoteFuc (item .file , (data ) => {
543533 reduceResult (item, data)
544534 if (! data) {
545535 this .$message .error (' 执行自定义上传出错' )
@@ -548,6 +538,16 @@ export default {
548538 resolve (item)
549539 }
550540 })
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+ }
551551 })
552552 }
553553
You can’t perform that action at this time.
0 commit comments