refactor(uploadFile): 替换toast为uni.showToast实现文件大小提示
使用uni.showToast替代原有的toast工具,以保持与uni-app框架的一致性
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { toast } from './toast'
|
||||
|
||||
/**
|
||||
* 文件上传钩子函数使用示例
|
||||
* @example
|
||||
@@ -111,7 +109,10 @@ export function useUpload<T = string>(url: string, formData: Record<string, any>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user