Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
e259093e
Commit
e259093e
authored
Jul 08, 2021
by
RuoYi
Browse files
文件上传组件添加数量限制属性
parent
e963a86b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-ui/src/components/FileUpload/index.vue
View file @
e259093e
...
...
@@ -4,7 +4,9 @@
:action=
"uploadFileUrl"
:before-upload=
"handleBeforeUpload"
:file-list=
"fileList"
:limit=
"limit"
:on-error=
"handleUploadError"
:on-exceed=
"handleExceed"
:on-success=
"handleUploadSuccess"
:show-file-list=
"false"
:headers=
"headers"
...
...
@@ -44,6 +46,11 @@ export default {
props
:
{
// 值
value
:
[
String
,
Object
,
Array
],
// 数量限制
limit
:
{
type
:
Number
,
default
:
5
,
},
// 大小限制(MB)
fileSize
:
{
type
:
Number
,
...
...
@@ -129,6 +136,10 @@ export default {
}
return
true
;
},
// 文件个数超出
handleExceed
()
{
this
.
$message
.
error
(
`上传文件数量不能超过
${
this
.
limit
}
个!`
);
},
// 上传失败
handleUploadError
(
err
)
{
this
.
$message
.
error
(
"
上传失败, 请重试
"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment