This commit is contained in:
2025-07-08 17:33:49 +08:00
parent de2aeb6abb
commit 31095494fd
8 changed files with 110 additions and 43 deletions

View File

@@ -3,6 +3,7 @@ import CLOSE_ICON from "../static/icons/close2.png";
import ADDICON from "../static/icons/add.png";
import {uploadFile} from "../utils/uils";
import XImage from "./XImage.vue";
import useUploadLength from "../hooks/useUploadLength.js";
const {size, single, del} = defineProps({
size: {
@@ -21,12 +22,21 @@ const {size, single, del} = defineProps({
const emits = defineEmits(['success']);
const files = defineModel('files');
if (single) useUploadLength({
array: files.value,
length: 1,
})
const upload = async () => {
uploadFile({
count: 1,
}).then(([res]) => {
const {data} = res;
files.value?.push(data);
if (!single) {
files.value?.push(data);
} else {
files.value = [data];
}
emits('success', data);
})
}