Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GaoQuIncubator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kimber
GaoQuIncubator
Commits
83dc5277
Commit
83dc5277
authored
Nov 23, 2024
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
孵化器上传图片格式限制
parent
a1e63816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
enterprise.vue
src/views/system/home/enterprise.vue
+14
-17
No files found.
src/views/system/home/enterprise.vue
View file @
83dc5277
...
...
@@ -92,12 +92,11 @@
class=
"upload-demo"
:action=
"`$
{baseAPI}api/file/upload?modelName=incubator`"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:before-upload="beforeUpload"
:on-success="handleSuccess"
:on-error="handleError"
:
limit="1
"
:on-exceed="handleExceed
"
:
on-change="handleChange
"
accept="image/png, image/jpeg, image/jpg
"
:file-list="fileList"
:show-file-list="false"
style="margin-bottom: 6px"
...
...
@@ -179,6 +178,16 @@ export default {
// this.getData();
},
methods
:
{
handleChange
(
file
)
{
this
.
fileList
=
[
file
];
// 保留最新上传的文件,覆盖旧文件
},
beforeUpload
(
file
)
{
const
isImage
=
file
.
type
.
startsWith
(
'
image/
'
);
if
(
!
isImage
)
{
this
.
$message
.
error
(
'
只能上传图片文件
'
);
}
return
isImage
;
},
handleSuccess
(
response
,
file
)
{
// 处理上传成功
console
.
log
(
"
Upload success:
"
,
response
,
file
);
...
...
@@ -198,22 +207,10 @@ export default {
status
:
"
上传失败
"
,
});
},
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
);
},
handlePreview
(
file
)
{
console
.
log
(
file
);
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`当前限制选择 3 个文件,本次选择了
${
files
.
length
}
个文件,共选择了
${
files
.
length
+
fileList
.
length
}
个文件`
);
},
beforeRemove
(
file
,
fileList
)
{
return
this
.
$confirm
(
`确定移除
${
file
.
name
}
?`
);
},
amapOptions
(
cmap
)
{
var
VUE
=
this
;
var
self
=
this
,
...
...
Write
Preview
Markdown
is supported
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