图库上传bug

This commit is contained in:
duan
2024-08-07 11:44:05 +08:00
parent 5377a76365
commit 7f54c59092
4 changed files with 68 additions and 32 deletions

View File

@@ -36,7 +36,7 @@ export default {
dialogImageUrl: '',
dialogVisible: false,
fileList: [],
files: [],
// files: [],
headers: {
'Authorization': getToken()
}
@@ -45,7 +45,13 @@ export default {
methods: {
handleSuccess(response, file, fileList) {
// console.log('上传成功', response)
this.files = response.data
setTimeout(() => {
this.fileList.push({
url: response.data[0],
id: response.data.id
})
}, 100);
// this.files = response.data
this.$emit('success', response.data)
},
// 监听上传失败
@@ -69,6 +75,9 @@ export default {
},
handleRemove(file, fileList) {
let arr = fileList.map(item => item.url)
// 删除数据
let index = this.fileList.findIndex(ele => ele.url == file.url)
this.fileList.splice(index, 1);
this.$emit('remove', arr)
},
clearFiles() {
@@ -76,4 +85,11 @@ export default {
}
}
}
</script>
</script>
<style>
.el-upload-list__item {
transition: none;
}
</style>