fix:UploadFile组件数据同步

pull/354/head
ccran 2023-12-27 12:36:11 +08:00
parent b4aa09aa6c
commit da6ab1ea00
1 changed files with 4 additions and 8 deletions

View File

@ -117,13 +117,9 @@ const excelUploadError: UploadProps['onError'] = (): void => {
message.error('导入数据失败,请您重新上传!')
}
//
const handleRemove = (file) => {
const findex = fileList.value.map((f) => f.name).indexOf(file.name)
if (findex > -1) {
fileList.value.splice(findex, 1)
const handleRemove = () => {
emitUpdateModelValue()
}
}
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
console.log(uploadFile)
}
@ -137,13 +133,13 @@ watch(
if (isString(props.modelValue)) {
// 1.1
if (props.modelValue.includes(',')) {
files.concat(props.modelValue.split(','))
files.push(...props.modelValue.split(','))
} else if (props.modelValue.length > 0) {
files.push(props.modelValue)
}
} else if (isArray(props.modelValue)) {
// 2
files.concat(props.modelValue)
files.push(...props.modelValue)
} else if (props.modelValue == null) {
// 3undefined
} else {