Forráskód Böngészése

feat: 1.File组件修正Icon属性显示bug 2. 添加 uploadApiPath 配置项

WANGKANG 10 hónapja
szülő
commit
21f97c6c98
1 módosított fájl, 9 hozzáadás és 4 törlés
  1. 9 4
      src/components/Upload/File.vue

+ 9 - 4
src/components/Upload/File.vue

@@ -16,7 +16,7 @@
       :accept="fileType.join(',')"
       :headers="headers"
     >
-      <el-button icon="icon" type="primary">{{ text }}</el-button>
+      <el-button :icon="icon" type="primary">{{ text }}</el-button>
     </el-upload>
     <!-- 上传提示 -->
     <div class="el-upload__tip" v-if="showTip">
@@ -54,6 +54,7 @@ import { globalHeaders } from '@/api'
 import { OssVO } from '@/api/interface/system/oss'
 import { getListByIdsApi, delOssApi } from '@/api/modules/system/oss'
 import { listToString } from '@/utils/common'
+
 interface UploadFileProps {
   modelValue?: string | number
   disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
@@ -64,7 +65,9 @@ interface UploadFileProps {
   text?: string // 按钮文字
   icon?: string
   fileType?: Array<string>
+  uploadApiPath: string // 上传文件服务器地址
 }
+
 // 默认值
 const props = withDefaults(defineProps<UploadFileProps>(), {
   modelValue: () => '',
@@ -72,13 +75,15 @@ const props = withDefaults(defineProps<UploadFileProps>(), {
   disabled: false,
   limit: 1,
   fileSize: 5,
-  fileType: () => ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'txt', 'pdf'],
+  fileType: () => ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'txt', 'pdf', 'mp4'],
   text: '文件上传',
-  isShowTip: true
+  isShowTip: true,
+  uploadApiPath: '/common/upload',
+  icon: 'upload-filled'
 })
 
 const baseUrl = import.meta.env.VITE_API_URL
-const uploadFileUrl = ref(baseUrl + '/common/upload') // 上传文件服务器地址
+const uploadFileUrl = ref(baseUrl + props.uploadApiPath)
 const headers = ref(globalHeaders())
 const uploadRef = ref<UploadInstance>()
 const number = ref(0)