mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
fix(front): update FileUpload component to allow all file types and improve type checking for accepted file formats
This commit is contained in:
@@ -6,7 +6,7 @@ const props = defineProps<{
|
||||
accept?: string[]
|
||||
}>()
|
||||
|
||||
const accept = computed(() => (props?.accept || ['image/*', 'video/*'])?.join(','))
|
||||
const accept = computed(() => (props?.accept || ['*'])?.join(','))
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'onChange', file: File): void
|
||||
@@ -24,6 +24,9 @@ const { isOverDropZone } = useDropZone(dropZoneRef, {
|
||||
for (const acceptType of accept.value.split(',')) {
|
||||
if (acceptType?.endsWith('*')) {
|
||||
const [acceptTypePrefix,] = acceptType?.split('/')
|
||||
if (!acceptTypePrefix) {
|
||||
return true
|
||||
}
|
||||
if (type?.startsWith(acceptTypePrefix)) {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user