From 4308f6889269d67ac3c603e7a4cd1820f395bc94 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 22 Aug 2025 17:16:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(uploadFile):=20=E6=9B=BF=E6=8D=A2toast?= =?UTF-8?q?=E4=B8=BAuni.showToast=E5=AE=9E=E7=8E=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用uni.showToast替代原有的toast工具,以保持与uni-app框架的一致性 --- src/utils/uploadFile.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/uploadFile.ts b/src/utils/uploadFile.ts index 416d39c..71848a2 100644 --- a/src/utils/uploadFile.ts +++ b/src/utils/uploadFile.ts @@ -1,5 +1,3 @@ -import { toast } from './toast' - /** * 文件上传钩子函数使用示例 * @example @@ -111,7 +109,10 @@ export function useUpload(url: string, formData: Record const checkFileSize = (size: number) => { const sizeInMB = size / 1024 / 1024 if (sizeInMB > maxSize) { - toast.warning(`文件大小不能超过${maxSize}MB`) + uni.showToast({ + title: `文件大小不能超过${maxSize}MB`, + icon: 'none', + }) return false } return true