fix:UploadFile组件数据同步
parent
b4aa09aa6c
commit
da6ab1ea00
|
|
@ -117,12 +117,8 @@ const excelUploadError: UploadProps['onError'] = (): void => {
|
||||||
message.error('导入数据失败,请您重新上传!')
|
message.error('导入数据失败,请您重新上传!')
|
||||||
}
|
}
|
||||||
// 删除上传文件
|
// 删除上传文件
|
||||||
const handleRemove = (file) => {
|
const handleRemove = () => {
|
||||||
const findex = fileList.value.map((f) => f.name).indexOf(file.name)
|
emitUpdateModelValue()
|
||||||
if (findex > -1) {
|
|
||||||
fileList.value.splice(findex, 1)
|
|
||||||
emitUpdateModelValue()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
|
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
|
||||||
console.log(uploadFile)
|
console.log(uploadFile)
|
||||||
|
|
@ -137,13 +133,13 @@ watch(
|
||||||
if (isString(props.modelValue)) {
|
if (isString(props.modelValue)) {
|
||||||
// 情况1.1:逗号分隔的多值
|
// 情况1.1:逗号分隔的多值
|
||||||
if (props.modelValue.includes(',')) {
|
if (props.modelValue.includes(',')) {
|
||||||
files.concat(props.modelValue.split(','))
|
files.push(...props.modelValue.split(','))
|
||||||
} else if (props.modelValue.length > 0) {
|
} else if (props.modelValue.length > 0) {
|
||||||
files.push(props.modelValue)
|
files.push(props.modelValue)
|
||||||
}
|
}
|
||||||
} else if (isArray(props.modelValue)) {
|
} else if (isArray(props.modelValue)) {
|
||||||
// 情况2:字符串
|
// 情况2:字符串
|
||||||
files.concat(props.modelValue)
|
files.push(...props.modelValue)
|
||||||
} else if (props.modelValue == null) {
|
} else if (props.modelValue == null) {
|
||||||
// 情况3:undefined 不处理
|
// 情况3:undefined 不处理
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue