This commit is contained in:
Viet An
2026-05-14 15:37:58 +07:00
parent 4d37397ee4
commit 1f44f9e6bf
17 changed files with 670 additions and 324 deletions

View File

@@ -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 },
};