swordpass-ui 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/swordpass-ui.common.js +51 -35
- package/lib/swordpass-ui.css +1 -1
- package/lib/swordpass-ui.umd.js +51 -35
- package/lib/swordpass-ui.umd.min.js +2 -2
- package/package.json +1 -1
- package/packages/File/src/main.vue +29 -7
package/package.json
CHANGED
|
@@ -219,7 +219,7 @@ export default {
|
|
|
219
219
|
return {
|
|
220
220
|
writeable: true,
|
|
221
221
|
temp: null,
|
|
222
|
-
refreshFileUploadDebounce:
|
|
222
|
+
refreshFileUploadDebounce: null,
|
|
223
223
|
inputVal: [],
|
|
224
224
|
}
|
|
225
225
|
},
|
|
@@ -311,10 +311,17 @@ export default {
|
|
|
311
311
|
},
|
|
312
312
|
},
|
|
313
313
|
created() {
|
|
314
|
+
this.refreshFileUploadDebounce = _.debounce(this.refreshFileUpload, 1000)
|
|
314
315
|
if (this.value) {
|
|
315
316
|
this.inputVal = JSON.parse(this.value)
|
|
316
317
|
}
|
|
317
318
|
},
|
|
319
|
+
beforeDestroy() {
|
|
320
|
+
// 组件销毁前取消防抖调用
|
|
321
|
+
if (this.refreshFileUploadDebounce) {
|
|
322
|
+
this.refreshFileUploadDebounce.cancel()
|
|
323
|
+
}
|
|
324
|
+
},
|
|
318
325
|
methods: {
|
|
319
326
|
//获取指定字符串点最后一个字符
|
|
320
327
|
substringType(str) {
|
|
@@ -383,7 +390,9 @@ export default {
|
|
|
383
390
|
// 清空操作
|
|
384
391
|
if (opType === 'clear') {
|
|
385
392
|
this.$emit('input', '')
|
|
386
|
-
this.refreshFileUploadDebounce
|
|
393
|
+
if (this.refreshFileUploadDebounce) {
|
|
394
|
+
this.refreshFileUploadDebounce()
|
|
395
|
+
}
|
|
387
396
|
return
|
|
388
397
|
}
|
|
389
398
|
|
|
@@ -414,7 +423,9 @@ export default {
|
|
|
414
423
|
|
|
415
424
|
// 更新组件值并刷新上传组件
|
|
416
425
|
this.$emit('input', ary.length > 0 ? JSON.stringify(ary) : '')
|
|
417
|
-
this.refreshFileUploadDebounce
|
|
426
|
+
if (this.refreshFileUploadDebounce) {
|
|
427
|
+
this.refreshFileUploadDebounce()
|
|
428
|
+
}
|
|
418
429
|
},
|
|
419
430
|
|
|
420
431
|
/**
|
|
@@ -455,9 +466,13 @@ export default {
|
|
|
455
466
|
// 同步附件数据到上传组件
|
|
456
467
|
refreshFileUpload() {
|
|
457
468
|
this.$nextTick(() => {
|
|
458
|
-
|
|
459
|
-
|
|
469
|
+
if (
|
|
470
|
+
this.$refs.fileUpload &&
|
|
471
|
+
typeof this.$refs.fileUpload.reload === 'function'
|
|
472
|
+
) {
|
|
460
473
|
this.$refs.fileUpload.reload(this.inputVal)
|
|
474
|
+
} else {
|
|
475
|
+
console.warn('FileUpload 组件尚未渲染或已卸载')
|
|
461
476
|
}
|
|
462
477
|
})
|
|
463
478
|
},
|
|
@@ -483,7 +498,12 @@ export default {
|
|
|
483
498
|
this.$emit('onSuccess', response, file, fileList)
|
|
484
499
|
},
|
|
485
500
|
removeFile(file) {
|
|
486
|
-
|
|
501
|
+
if (
|
|
502
|
+
this.$refs.fileUpload &&
|
|
503
|
+
typeof this.$refs.fileUpload.abort === 'function'
|
|
504
|
+
) {
|
|
505
|
+
this.$refs.fileUpload.abort(file)
|
|
506
|
+
}
|
|
487
507
|
this.valueOpration(this.convertFile2Item(file), 'remove')
|
|
488
508
|
this.$emit('remove', file, this.inputVal)
|
|
489
509
|
},
|
|
@@ -532,7 +552,9 @@ export default {
|
|
|
532
552
|
},
|
|
533
553
|
handleSort(data) {
|
|
534
554
|
this.$emit('input', JSON.stringify(data))
|
|
535
|
-
this.refreshFileUploadDebounce
|
|
555
|
+
if (this.refreshFileUploadDebounce) {
|
|
556
|
+
this.refreshFileUploadDebounce()
|
|
557
|
+
}
|
|
536
558
|
},
|
|
537
559
|
},
|
|
538
560
|
}
|