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