From 11046287e3b304a342615cffc220ec0fdf64bcea Mon Sep 17 00:00:00 2001 From: mayiming <1627832236@qq.com> Date: Mon, 27 Oct 2025 17:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8D=89=E7=A8=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- management/text.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 management/text.md diff --git a/management/text.md b/management/text.md new file mode 100644 index 00000000..07bffcb3 --- /dev/null +++ b/management/text.md @@ -0,0 +1,25 @@ +const beforeUpload: UploadProps['beforeUpload'] = (rawFile) => { +const allowTypes = ['image/jpeg', 'image/png', 'image/webp']; +if (!allowTypes.includes(rawFile.type)) { +ElMessage.error('仅支持JPG/PNG/WEBP格式的图片'); +return false; +} +if (rawFile.size / 1024 / 1024 > 5) { +ElMessage.error('图片大小不能超过5MB'); +return false; +} +console.log("检验成功"); +return true; +}; + +// 上传成功处理 +const handleUploadSuccess = (response: any, index: number) => { +console.log("上传结果:", response); +const ossUrl = response.data?.url; +if (ossUrl) { +carouselItems.value[index].imageUrl = ossUrl; +ElMessage.success(`轮播图 ${index + 1} 上传成功`); +} else { +ElMessage.error(`轮播图 ${index + 1} 上传失败`); +} +}; \ No newline at end of file