Skip to content

Commit 82f56f9

Browse files
committed
1
1 parent 92efdf4 commit 82f56f9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

  • demo/WalkingTec.Mvvm.Vue3Demo/ClientApp/src/components/uploadFile

demo/WalkingTec.Mvvm.Vue3Demo/ClientApp/src/components/uploadFile/index.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const header = computed(() => {
4747
return { Authorization: `Bearer ${Local.get('token')}` }
4848
})
4949
watch(filevalue, async () => {
50-
if(!filevalue.value){
50+
debugger;
51+
if(!filevalue.value){
5152
files.value = [];
5253
return;
5354
}
@@ -56,7 +57,6 @@ watch(filevalue, async () => {
5657
files.value = [];
5758
}
5859
if (props.multi == false) {
59-
6060
let fv = null;
6161
if (files.value && files.value.length > 0) {
6262
fv = files.value[0].FileId;
@@ -110,7 +110,7 @@ const onSuccess = (res: any, uploadFile: any, uploadFiles: any) => {
110110
}
111111
}
112112
113-
const onRemove = (file: any) => {
113+
const onRemove = (file: any) => {
114114
fileApi().deleteFile(file.FileId);
115115
const f = files.value;
116116
if (f) {
@@ -123,8 +123,13 @@ const onRemove = (file: any) => {
123123
index--;
124124
}
125125
}
126-
}
127-
filevalue.value = f.map((item:any)=>{return {FileId: item.FileId, ID: item.keyID}});
126+
}
127+
if (props.multi == false) {
128+
filevalue.value = null;
129+
}
130+
else {
131+
filevalue.value = f.map((item: any) => { return { FileId: item.FileId, ID: item.keyID } });
132+
}
128133
}
129134
// 暴露变量
130135
defineExpose({

0 commit comments

Comments
 (0)