Przeglądaj źródła

上传组件 添加音频文件上传

DESKTOP-O04BTUJ\muzen 2 lat temu
rodzic
commit
cb6388d644
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      src/components/Upload/index.vue

+ 4 - 3
src/components/Upload/index.vue

@@ -4,7 +4,7 @@
       :name="name" :show-file-list="showFileList" :drag="drag" :accept="accept" :listType="listType"
       :autoUpload="autoUpload" :disabled="disabled" :before-upload="beforeUpload" :on-progress="onProgress"
       :on-success="onSuccess" :on-error="onError">
-      <el-button v-if="listType === 'text'" :type="type" size="mini" ref="upload">
+      <el-button v-if="listType !== 'picture-card'" :type="type" ref="upload">
         <slot v-if="percentage <= 0 && !form.file">点击上传</slot>
         <span v-if="percentage > 0 && !form.file">{{ title }}</span>
         <span v-if="form.file">上传成功</span>
@@ -72,7 +72,8 @@ export default {
       // 上传类型
       obj: {
         'text': `${baseUrl}/system/file/file/upload`,
-        'picture-card': `${baseUrl}/system/file/picture/upload`
+        'picture-card': `${baseUrl}/system/file/picture/upload`,
+        'audio': `${baseUrl}/system/file/mp3/upload`
       },
       // 上传地址
       action: '#',
@@ -182,7 +183,7 @@ export default {
 
     // 上传按钮
     isBtn() {
-      return this.listType === 'text' || (this.listType === 'picture-card' && this.percentage == 0 && !this.form.file)
+      return ['text', 'audio'].includes(this.listType) || (this.listType === 'picture-card' && this.percentage == 0 && !this.form.file)
     },
     // 显示进度条
     isPercentage() {