update
This commit is contained in:
@@ -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);
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user