feat: 添加typeKua属性以支持上传文件大小限制

This commit is contained in:
傅光孟 2026-04-11 12:18:41 +08:00
parent 167a24f7d3
commit dfd438844c
2 changed files with 11 additions and 5 deletions

View File

@ -56,6 +56,7 @@
marginTop: '20px',
}"
class="upload"
:typeKua="true"
@handleAvatarSuccess="handleAvatarSuccess"
@onProgress="onUploadProgress"
@onChange="onUploadChange"
@ -90,6 +91,7 @@
marginTop: '20px',
}"
class="upload"
:typeKua="true"
@handleAvatarSuccess="handleAvatarSuccess2"
@onProgress="onUploadProgress2"
@onChange="onUploadChange2"

View File

@ -50,6 +50,10 @@ const props = defineProps({
model: {
type: Object,
},
typeKua: {
type: Boolean,
default: () => false,
}
});
const emit = defineEmits(['handleAvatarSuccess', 'onProgress', 'onChange']);
const uploadData = ref({});
@ -144,11 +148,11 @@ async function onBeforeUpload(res) {
ElMessage.error('请上传PDF或docx文件');
}
// // 10M
// if (res.size > 10 * 1024 * 1024) {
// canGo = false;
// ElMessage.error('10M');
// }
// 10M
if (props.typeKua && res.size > 10 * 1024 * 1024) {
canGo = false;
ElMessage.error('文件大小不能超过10M');
}
// let { code, data } = await getWordFlag({});
// if (code == 200) {