odc.xiaohui
2023-11-15 4de5f40a1a7df4a252b0f44869e7599a066c06b2
src/components/FileUpload/index.vue
@@ -11,6 +11,7 @@
      class="upload-file-uploader"
      ref="fileUploadRef"
      :auto-upload="false"
      :on-exceed="handleExceed"
    >
      <!-- 上传按钮 -->
      <el-button type="primary">选取文件</el-button>
@@ -47,9 +48,9 @@
const props = defineProps({
    modelValue: [String, Object, Array],
    // 数量限制
    limit: propTypes.number.def(10),
    limit: propTypes.number.def(1),
    // 大小限制(MB)
    fileSize: propTypes.number.def(5),
    fileSize: propTypes.number.def(200),
    // 文件类型, 例如['png', 'jpg', 'jpeg']
    fileType: propTypes.array.def(["doc","docx","xlsx", "xls", "ppt", "txt", "pdf"]),
    // 是否显示提示
@@ -174,8 +175,9 @@
// 上传成功回调
const handleUploadSuccess = (res: any, file: UploadFile) => {
    if (res.code === 200) {
      emit('closePopup')
      console.log('调用父组件');
      emit('closePopup',res.data)
      console.log('调用父组件',res);
      fileUploadRef.value!.clearFiles()
      downloadLoadingInstance.close();
        uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });