图库上传bug
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user