Skip to content

Commit

Permalink
feat: 剪切板页面文件上传限制大小为 10MiB
Browse files Browse the repository at this point in the history
  • Loading branch information
HouLiXieBuRou authored and MingcongBai committed Sep 23, 2024
1 parent fcadfdf commit c2cc5d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/paste/PasteIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ const editorOptions = ref({
enabled: false
}
});
const handleChange = (
uploadFile,
uploadFiles
) => {
if (uploadFile.size / 1024 / 1024 > 10) {
ElMessage.error(`${uploadFile.name} 超出10MB的文件最大限制!`);
selectedFileList.value.pop();
} else
ElMessage.success(
`成功添加文件: ${uploadFile.name}`
);
};
</script>

<template>
Expand Down Expand Up @@ -147,6 +160,7 @@ const editorOptions = ref({
class="upload-demo my-[10px]"
:auto-upload="false"
v-model:file-list="selectedFileList"
:on-change="handleChange"
drag
multiple>
<div class="h-[26px] my-[-26px]">
Expand Down

0 comments on commit c2cc5d9

Please sign in to comment.