| | |
| | | <template>
|
| | | <div class="component-upload-image">
|
| | | <el-upload
|
| | | multiple
|
| | | :action="uploadImgUrl"
|
| | | list-type="picture-card"
|
| | | :on-success="handleUploadSuccess"
|
| | |
| | |
|
| | | const { proxy } = getCurrentInstance();
|
| | | const emit = defineEmits();
|
| | | const number = ref(0);
|
| | | const uploadList = ref([]);
|
| | | const dialogImageUrl = ref("");
|
| | | const dialogVisible = ref(false);
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
| | |
| | |
|
| | | // 上传成功回调
|
| | | function handleUploadSuccess(res) {
|
| | | fileList.value.push({ name: res.fileName, url: res.fileName });
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | proxy.$modal.closeLoading();
|
| | | uploadList.value.push({ name: res.fileName, url: res.fileName });
|
| | | if (uploadList.value.length === number.value) {
|
| | | fileList.value = fileList.value.concat(uploadList.value);
|
| | | uploadList.value = [];
|
| | | number.value = 0;
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | proxy.$modal.closeLoading();
|
| | | }
|
| | | }
|
| | |
|
| | | // 上传前loading加载
|
| | |
| | | }
|
| | | }
|
| | | proxy.$modal.loading("上传中");
|
| | | number.value++;
|
| | | }
|
| | |
|
| | | // 文件个数超出
|