|
@@ -13,7 +13,7 @@
|
|
|
:on-change="handleChangeFile"
|
|
|
:on-success="updateData"
|
|
|
:disabled="props.readonly"
|
|
|
- :on-error="onUploadError"
|
|
|
+ :on-error="onUploadError"
|
|
|
>
|
|
|
<template v-if="!props.readonly">
|
|
|
<el-button> <SvgIcon name="ele-Upload" /> {{ props.name }} </el-button>
|
|
@@ -130,7 +130,7 @@ const handleExceed = (files: any, fileList: any) => {
|
|
|
//限制文件大小
|
|
|
const handleChangeFile = (file: any, fileList: any) => {
|
|
|
//限制上传文件大小
|
|
|
- updateData();
|
|
|
+ updateData();
|
|
|
if (!file) return;
|
|
|
const isLt2M = file.size / 1024 / 1024 < props.fileSize;
|
|
|
if (!isLt2M) {
|
|
@@ -142,8 +142,8 @@ const handleChangeFile = (file: any, fileList: any) => {
|
|
|
};
|
|
|
// 上传失败
|
|
|
const onUploadError = (error: Error) => {
|
|
|
- console.log(error)
|
|
|
- ElMessage.error('上传失败');
|
|
|
+ console.log(error);
|
|
|
+ ElMessage.error('上传失败');
|
|
|
};
|
|
|
// 删除
|
|
|
const handleRemove = (uploadFile: any) => {
|
|
@@ -198,11 +198,11 @@ const onPreview = (file: any) => {
|
|
|
};
|
|
|
watch(
|
|
|
() => props.modelValue,
|
|
|
- (n) => {
|
|
|
+ (n: any) => {
|
|
|
fileList.value = n;
|
|
|
- emit("update:modelValue", fileList.value);
|
|
|
- const data = formatData(Other.deepClone(fileList.value));
|
|
|
- emit('update:format', data);
|
|
|
+ emit('update:modelValue', fileList.value);
|
|
|
+ const data = formatData(Other.deepClone(fileList.value));
|
|
|
+ emit('update:format', data);
|
|
|
},
|
|
|
{ deep: true, immediate: true }
|
|
|
);
|