##### 版本号:
2.0.2
##### 问题描述:
这样的场景:
有个界面用到的上传组件jupload,有一个问题,就是如果在添加的时候上传了文件,或者点击编辑的时候有已经上传的文件,那么下次再点击增加新的记录的时候,上传文件列表会保留上次上次的文件列表;
##### 截图&代码:
问题截图:
第一次点击新增,弹出新增界面:

没问题!
点击文件上传:

保存,
然后再点击新增界面:

还是上次上传后的界面
原因在于Jupload.vue控件在监听value编号的时候,对于value为空,处理有问题
` `
initFileList(paths){
if(!paths || paths.length==0){
return ;
}
let fileList = [];
let arr = paths.split(",")
for(var a=0;a<arr.length;a++){
fileList.push({
uid:uidGenerator(),
name:getFileName(arr[a]),
status: 'done',
url: this.urlDownload+arr[a],
response:{
status:"history",
message:arr[a]
}
})
}
this.fileList = fileList
},
应该在判断长度为0的时候增加以下代码:
` `
initFileList(paths){
if(!paths || paths.length==0){
**this.fileList = [];**
return ;
}
let fileList = [];
let arr = paths.split(",")
for(var a=0;a<arr.length;a++){
fileList.push({
uid:uidGenerator(),
name:getFileName(arr[a]),
status: 'done',
url: this.urlDownload+arr[a],
response:{
status:"history",
message:arr[a]
}
})
}
this.fileList = fileList
},