Bug: frontend: Avoid select multiple files

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2021-01-27 00:01:52 +08:00
parent f7cc4e9b89
commit c460af8273
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -3,7 +3,7 @@
<div ref="terminal" :style="{height: termHeight + 'px'}" @contextmenu.prevent="showContextmenu"/>
<el-dialog ref="dialog" :visible.sync="file.modal" :title="$t('Upload file to device')" width="350px"
@close="onUploadDialogClosed">
<el-upload ref="upload" action="" :auto-upload="false" :http-request="doUploadFile">
<el-upload ref="upload" action="" :auto-upload="false" :file-list="file.list" :on-change="handleFileChange" :http-request="doUploadFile">
<el-button slot="trigger" size="small" type="primary">{{ $t("Select file") }}</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUploadFile">{{ $t('Upload') }}
</el-button>
@@ -37,6 +37,7 @@
disposables: IDisposable[] = [];
file = {
name: '',
list: [],
modal: false,
recving: false,
accepted: false,
@@ -92,11 +93,16 @@
onUploadDialogClosed() {
this.term?.focus();
this.file.list = [];
if (this.file.accepted)
return;
this.sendFileData(MsgTypeFileCanceled, null);
}
handleFileChange(file, fileList) {
this.file.list = fileList.slice(-1);
}
submitUploadFile() {
(this.$refs.upload as ElUpload).submit();
}
+1 -1
View File
File diff suppressed because one or more lines are too long