feat(components): [el-upload] clearFiles support filter status (#1501)

This commit is contained in:
高奕GaoYi 2021-09-13 03:13:11 +08:00 committed by GitHub
parent 31bd0b12fb
commit 00d38e1807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {