fix: 修复文件上传失败的BUG
This commit is contained in:
@@ -366,8 +366,20 @@ export default {
|
|||||||
obj.name = file.response.data.oldFileName
|
obj.name = file.response.data.oldFileName
|
||||||
obj.response.data = file.response.data
|
obj.response.data = file.response.data
|
||||||
this.showFileList.push(obj)
|
this.showFileList.push(obj)
|
||||||
// this.value += res.data.id + ','
|
let attrIds=""
|
||||||
this.$emit('input', this.value ? (this.value + ','+ res.data.id + ',').replaceAll(",,",',') : (this.value+ res.data.id + ',').replaceAll(',,',','))
|
if(this.value != null && this.value !== ''){
|
||||||
|
let attrArray= this.value.split(',')
|
||||||
|
// 方法二:filter方法 [推荐写法]
|
||||||
|
let attrIdsArray = attrArray.filter((s) => {
|
||||||
|
return s && s.trim(); // 注:IE9(不包含IE9)以下的版本没有trim()方法
|
||||||
|
});
|
||||||
|
attrIdsArray.push(res.data.id);
|
||||||
|
console.log(attrIdsArray)
|
||||||
|
attrIds = attrIdsArray.join(',')+","
|
||||||
|
}else{
|
||||||
|
attrIds =res.data.id+","
|
||||||
|
}
|
||||||
|
this.$emit('input', attrIds)
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '文件上传成功',
|
message: '文件上传成功',
|
||||||
|
|||||||
Reference in New Issue
Block a user