mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
feat(components): [el-upload] clearFiles
support filter status (#1501)
This commit is contained in:
parent
31bd0b12fb
commit
00d38e1807
@ -6,6 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
import type {
|
||||
ListType,
|
||||
UploadFile,
|
||||
UploadStatus,
|
||||
ElFile,
|
||||
ElUploadProgressEvent,
|
||||
IUseHandlersProps,
|
||||
@ -33,8 +34,10 @@ export default (props: IUseHandlersProps) => {
|
||||
uploadRef.value.abort(file)
|
||||
}
|
||||
|
||||
function clearFiles() {
|
||||
uploadFiles.value = []
|
||||
function clearFiles(status: UploadStatus[] = ['success', 'fail']) {
|
||||
uploadFiles.value = uploadFiles.value.filter((row) => {
|
||||
return status.indexOf(row.status) === -1
|
||||
})
|
||||
}
|
||||
|
||||
function handleError(err: Error, rawFile: ElFile) {
|
||||
|
Loading…
Reference in New Issue
Block a user