changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!-- extract logic to a composable -->
|
||||
<!-- TODO: extract logic to a composable -->
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
@@ -14,7 +14,7 @@
|
||||
ref="file-input"
|
||||
type="file"
|
||||
:id="docid"
|
||||
multiple
|
||||
:multiple="multiple ?? true"
|
||||
name="resume"
|
||||
@change="doChange"
|
||||
/>
|
||||
@@ -47,6 +47,7 @@ const props = defineProps({
|
||||
type: Array,
|
||||
convert: String,
|
||||
quality: Number,
|
||||
multiple: Boolean,
|
||||
});
|
||||
|
||||
const emit = defineEmits(["files"]);
|
||||
@@ -85,24 +86,25 @@ function doChange() {
|
||||
const convertValue = props.convert ? "1" : "0";
|
||||
const qualityValue = props.convert && props.quality ? props.quality : null;
|
||||
|
||||
files.value.map((v) => {
|
||||
const ext = getFileExtension(v.name);
|
||||
for (const file of files.value) {
|
||||
const ext = getFileExtension(file.name);
|
||||
const type = getType(ext);
|
||||
|
||||
if (!vtype.includes(type)) {
|
||||
$snackbar(`Định dạng file "${ext}" không hợp lệ`);
|
||||
fileInput.value.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const file = $upload(v, type, 1, convertValue, qualityValue);
|
||||
dataFiles.value.push(file);
|
||||
});
|
||||
const dataFile = $upload(file, type, 1, convertValue, qualityValue);
|
||||
dataFiles.value.push(dataFile);
|
||||
}
|
||||
|
||||
showmodal.value = {
|
||||
component: "media/UploadProgress",
|
||||
title: "Upload files",
|
||||
title: "Upload Files",
|
||||
width: "700px",
|
||||
height: "200px",
|
||||
height: "auto",
|
||||
vbind: { files: dataFiles.value },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user