@lambo-design/upload-file 1.0.0-beta.27 → 1.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.vue +28 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/upload-file",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"axios": "^0.24.0",
|
|
14
14
|
"axios-cache-plugin": "^0.1.0",
|
|
15
|
-
"@lambo-design/shared": "^1.0.0-beta.
|
|
16
|
-
"@lambo-design/core": "^4.7.1-beta.
|
|
15
|
+
"@lambo-design/shared": "^1.0.0-beta.250",
|
|
16
|
+
"@lambo-design/core": "^4.7.1-beta.158"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"release-upload-file": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
package/src/index.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="upload-file-box">
|
|
3
|
-
<div class="upload-btn-box">
|
|
3
|
+
<div class="upload-btn-box" v-if="!disabled">
|
|
4
4
|
<slot>
|
|
5
5
|
<Button :size="buttonSize" icon="md-add" type="primary" :loading="loading"
|
|
6
6
|
@click="UploadFile()" ghost v-if="uploadBtn">
|
|
@@ -11,9 +11,12 @@
|
|
|
11
11
|
<Icon type="md-add"></Icon>
|
|
12
12
|
上传附件
|
|
13
13
|
</a>
|
|
14
|
+
<span style="margin-left: 10px; color: #ed4014">
|
|
15
|
+
{{ descInfo }}
|
|
16
|
+
</span>
|
|
14
17
|
</slot>
|
|
15
18
|
</div>
|
|
16
|
-
<input type="file" :disabled="
|
|
19
|
+
<input type="file" :disabled="disabled" ref="uploadInput" style="position:absolute; clip:rect(0 0 0 0);display: none"
|
|
17
20
|
:multiple="multiple"
|
|
18
21
|
:accept="accept"
|
|
19
22
|
@change="readFile($event, 1)"/>
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
</div>
|
|
29
32
|
<div span="3" style="text-align: right">
|
|
30
33
|
<Button v-if="showPreview" @click="previewFile(item)" type="text">预览</Button>
|
|
31
|
-
<Button @click="deleteFile(item.fileId ? item.fileId : item.fileCode)" type="text">删除</Button>
|
|
34
|
+
<Button v-if="!disabled" @click="deleteFile(item.fileId ? item.fileId : item.fileCode)" type="text">删除</Button>
|
|
32
35
|
</div>
|
|
33
36
|
</ListItem>
|
|
34
37
|
</List>
|
|
@@ -55,6 +58,12 @@ export default {
|
|
|
55
58
|
required: false,
|
|
56
59
|
default: "pdf|doc|docx|txt|xls|xlsx|jpg|jpeg|png|gif|zip|rar"
|
|
57
60
|
},
|
|
61
|
+
//描述信息
|
|
62
|
+
descInfo: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false,
|
|
65
|
+
default: ""
|
|
66
|
+
},
|
|
58
67
|
//标题
|
|
59
68
|
title: {
|
|
60
69
|
type: String,
|
|
@@ -66,6 +75,17 @@ export default {
|
|
|
66
75
|
type: Boolean,
|
|
67
76
|
default: false
|
|
68
77
|
},
|
|
78
|
+
//是否禁用
|
|
79
|
+
disabled: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
//上传图片最大限制 单位:MB
|
|
84
|
+
fileMaxSize: {
|
|
85
|
+
type: Number,
|
|
86
|
+
required: false,
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
69
89
|
//限制上传数量
|
|
70
90
|
limitFileNum: {
|
|
71
91
|
type: Number,
|
|
@@ -183,6 +203,11 @@ export default {
|
|
|
183
203
|
self.loading = false;
|
|
184
204
|
return false;
|
|
185
205
|
} else {
|
|
206
|
+
if (this.fileMaxSize && file.size > this.fileMaxSize * 1024 * 1024) {
|
|
207
|
+
self.$Message.error("上传文件大小需要小于" + this.fileMaxSize + "MB");
|
|
208
|
+
self.loading = false;
|
|
209
|
+
return
|
|
210
|
+
}
|
|
186
211
|
self.attachmentFile.fileName = file;
|
|
187
212
|
if (self.attachmentFile.fileName.name.indexOf("/") > 0) {
|
|
188
213
|
self.attachmentFile.fileName = self.attachmentFile.fileName.name.substring(self.attachmentFile.fileName.name.lastIndexOf("/") + 1);
|