Skip to content

Commit

Permalink
优化upload组件高亮以及上传成功数据逻辑 (#213)
Browse files Browse the repository at this point in the history
* update unload css,delete callback & suggestion bugs & debounce

* 优化upload组件高亮以及上传成功数据逻辑
  • Loading branch information
AlbusW authored and wanluw committed Jun 26, 2018
1 parent 0106ace commit 5582b7c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion demos/components/suggestion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@
];
},
handleChange(val){
// console.log('change',val)
}
},
mounted() {
Expand Down
20 changes: 13 additions & 7 deletions src/components/upload/src/upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@
immediate: true,
deep: true,
handler(val){
this.uploadFiles = val.map(item => {
item.uid = item.uid || (Date.now() + this.fileIndex++);
item.status = 'success';
return item;
});
this.copyFileList(val)
}
}
},
Expand Down Expand Up @@ -152,9 +148,12 @@
let file = this.getFile(rawFile);
file.status = 'success';
file.response = res;
let arr = this.uploadFiles;
this.onSuccess(res, file, this.uploadFiles);
this.onChange(file, this.uploadFiles);
this.copyFileList(this.fileList);
this.onSuccess(res, file, arr);
this.onChange(file, arr);
},
handleError(err, rawFile) {
let file = this.getFile(rawFile);
Expand Down Expand Up @@ -185,6 +184,13 @@
});
return file;
},
copyFileList(val) {
this.uploadFiles = val.map(item => {
item.uid = item.uid || (Date.now() + this.fileIndex++);
item.status = 'success';
return item;
});
}
},
render(h) {
Expand Down
4 changes: 2 additions & 2 deletions src/less/components/upload.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
vertical-align: top;
}
&-picture:hover{
border-color: @lightseagreen-6;
border-color: @brand-primary;
}

&-file-input {
Expand Down Expand Up @@ -68,7 +68,7 @@

&:hover,&:focus {
text-decoration: none;
color: @lightseagreen-6;
color: @brand-primary;
}
}
}
Expand Down

0 comments on commit 5582b7c

Please sign in to comment.