Skip to content

Commit 7645c6d

Browse files
committed
feat: 文件上传组件新增disabled属性
1 parent 6107397 commit 7645c6d

File tree

1 file changed

+8
-2
lines changed
  • ruoyi-fastapi-frontend/src/components/FileUpload

1 file changed

+8
-2
lines changed

ruoyi-fastapi-frontend/src/components/FileUpload/index.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
:headers="headers"
1414
class="upload-file-uploader"
1515
ref="fileUpload"
16+
v-if="!disabled"
1617
>
1718
<!-- 上传按钮 -->
1819
<el-button type="primary">选取文件</el-button>
1920
</el-upload>
2021
<!-- 上传提示 -->
21-
<div class="el-upload__tip" v-if="showTip">
22+
<div class="el-upload__tip" v-if="showTip && !disabled">
2223
请上传
2324
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
2425
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
@@ -31,7 +32,7 @@
3132
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
3233
</el-link>
3334
<div class="ele-upload-list__item-content-action">
34-
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
35+
<el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled">删除</el-link>
3536
</div>
3637
</li>
3738
</transition-group>
@@ -62,6 +63,11 @@ const props = defineProps({
6263
isShowTip: {
6364
type: Boolean,
6465
default: true
66+
},
67+
// 禁用组件(仅查看文件)
68+
disabled: {
69+
type: Boolean,
70+
default: false
6571
}
6672
});
6773

0 commit comments

Comments
 (0)