|
@@ -69,6 +69,10 @@ const props = defineProps({
|
|
|
type: Array<string>,
|
|
|
default: () => [],
|
|
|
},
|
|
|
+ pdfList: {
|
|
|
+ type: Array<string>,
|
|
|
+ default: () => [],
|
|
|
+ },
|
|
|
generatePdf: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
@@ -77,11 +81,17 @@ const props = defineProps({
|
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
|
-const emit = defineEmits(["update:src", "update:srcList"]);
|
|
|
+const emit = defineEmits([
|
|
|
+ "update:src",
|
|
|
+ "update:srcList",
|
|
|
+ "update:pdfList",
|
|
|
+ "finished",
|
|
|
+]);
|
|
|
|
|
|
// 上传文件成功返回的值
|
|
|
const src = useVModel(props, "src", emit); //单文件用这个
|
|
|
const srcList = useVModel(props, "srcList", emit); //多文件用这个
|
|
|
+const pdfList = useVModel(props, "pdfList", emit); //转换成pdf后的多文件用这个
|
|
|
|
|
|
// el-upload 绑定的值
|
|
|
const fileList = ref<UploadUserFile[]>([]);
|
|
@@ -97,7 +107,9 @@ const handleChange = async (uploadFile: UploadFile) => {
|
|
|
loading.value = false;
|
|
|
let url = props.generatePdf ? res.data.pdfUrl : res.data.fileUrl;
|
|
|
src.value = url;
|
|
|
- srcList.value.push(url);
|
|
|
+ pdfList.value.push(url);
|
|
|
+ srcList.value.push(res.data.fileUrl);
|
|
|
+ emit("finished");
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
ElMessage.error(err.message);
|