fix bug 4
This commit is contained in:
@@ -27,11 +27,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type {UploadChangeParam, UploadProps} from 'ant-design-vue'
|
||||
import {Upload, message} from 'ant-design-vue'
|
||||
import {message} from 'ant-design-vue'
|
||||
import {uploadURL} from '@root/config'
|
||||
import {getToken} from '@/utils'
|
||||
import {fixFileCapture} from '@/utils/fixFileCapture'
|
||||
import {normalizeUploadFileResponse} from '@/utils/file'
|
||||
import {createWebpBeforeUpload} from '@/utils/prepareImageForUpload'
|
||||
import {usePrefix} from '@core/composable/usePrefix'
|
||||
import {computed, onMounted, ref} from 'vue'
|
||||
|
||||
@@ -59,20 +60,9 @@ const fileList = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
if (!file.size || file.size < 1) {
|
||||
message.error('فایل خالی است')
|
||||
return Upload.LIST_IGNORE
|
||||
}
|
||||
|
||||
const isLt240k = file.size / 1024 < 240
|
||||
if (!isLt240k) {
|
||||
message.error('حداکثر حجم بارگذاری ۲۴۰ کیلوبایت میباشد')
|
||||
return Upload.LIST_IGNORE
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
const beforeUpload: UploadProps['beforeUpload'] = createWebpBeforeUpload((msg) =>
|
||||
message.error(msg)
|
||||
)
|
||||
|
||||
function handleChange(info: UploadChangeParam) {
|
||||
fixFileCapture()
|
||||
|
||||
Reference in New Issue
Block a user