Skip to content

Commit 9046245

Browse files
committed
perf: Add header to file uploader with clear selection
1 parent 991a512 commit 9046245

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/views/ops/File/index.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
class="file-uploader"
5656
>
5757
<el-card>
58+
<div class="file-uploader-header">
59+
<span>{{ $t('selectFiles', {number: uploadFileList.length}) }}</span>
60+
<el-tooltip v-if="uploadFileList.length > 0" :content="$t('ClearSelection')" placement="top">
61+
<i class="el-icon-delete" @click="clearAllFiles" />
62+
</el-tooltip>
63+
</div>
5864
<el-upload
5965
v-if="ready"
6066
ref="upload"
@@ -450,6 +456,10 @@ export default {
450456
},
451457
handleSelectAssets(assets) {
452458
this.selectHosts = assets
459+
},
460+
clearAllFiles() {
461+
this.$refs.upload.clearFiles()
462+
this.uploadFileList = []
453463
}
454464
}
455465
}
@@ -515,8 +525,15 @@ export default {
515525
margin: 10px 0;
516526
min-width: 925px;
517527
528+
.file-uploader-header {
529+
display: flex;
530+
justify-content: space-between;
531+
align-items: center;
532+
padding-bottom: 5px;
533+
}
534+
518535
::v-deep .el-card__body {
519-
> div:first-child {
536+
> div:nth-child(2) {
520537
//不要影响到 el-progress
521538
display: flex;
522539
position: relative;

0 commit comments

Comments
 (0)