refactor: ♻️ 单图上传不显示文件列表

This commit is contained in:
Ray.Hao
2025-02-03 22:59:11 +08:00
parent 4b3f2fb51a
commit 05c1a2412a

View File

@@ -4,6 +4,7 @@
v-model="modelValue" v-model="modelValue"
class="single-upload" class="single-upload"
list-type="picture-card" list-type="picture-card"
:show-file-list="false"
:accept="props.accept" :accept="props.accept"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:http-request="handleUpload" :http-request="handleUpload"
@@ -24,7 +25,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElImageViewer, UploadRawFile, UploadRequestOptions } from "element-plus"; import { UploadRawFile, UploadRequestOptions } from "element-plus";
import FileAPI, { FileInfo } from "@/api/file"; import FileAPI, { FileInfo } from "@/api/file";
const props = defineProps({ const props = defineProps({
@@ -45,7 +46,7 @@ const props = defineProps({
default: "file", default: "file",
}, },
/** /**
* 文件大小允许最大单位MB * 最大文件大小单位M
*/ */
maxFileSize: { maxFileSize: {
type: Number, type: Number,
@@ -53,11 +54,11 @@ const props = defineProps({
}, },
/** /**
* 接收文件类型 * 上传图片格式,默认支持所有图片(image/*),指定格式示例:'.png,.jpg,.jpeg,.gif,.bmp'
*/ */
accept: { accept: {
type: String, type: String,
default: "image/*", // 默认支持所有图片格式 ,如果需要指定格式,格式如下:'.png,.jpg,.jpeg,.gif,.bmp' default: "image/*",
}, },
/** /**
@@ -67,8 +68,8 @@ const props = defineProps({
type: Object, type: Object,
default: () => { default: () => {
return { return {
width: "130px", width: "150px",
height: "130px", height: "150px",
}; };
}, },
}, },