Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
9bca25ba
Commit
9bca25ba
authored
Mar 18, 2024
by
杨南鸿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新upload组件参数
parent
4b4f75fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
13 deletions
+30
-13
packages/upload/src/index.vue
packages/upload/src/index.vue
+5
-0
packages/upload/src/upload.vue
packages/upload/src/upload.vue
+25
-13
No files found.
packages/upload/src/index.vue
View file @
9bca25ba
...
...
@@ -103,6 +103,10 @@ export default {
onExceed
:
{
type
:
Function
,
default
:
noop
},
needTitle
:
{
type
:
Boolean
,
default
:
false
}
},
...
...
@@ -306,6 +310,7 @@ export default {
listType
:
this
.
listType
,
disabled
:
this
.
uploadDisabled
,
limit
:
this
.
limit
,
needTitle
:
this
.
needTitle
,
'
on-exceed
'
:
this
.
onExceed
,
'
on-start
'
:
this
.
handleStart
,
'
on-progress
'
:
this
.
handleProgress
,
...
...
packages/upload/src/upload.vue
View file @
9bca25ba
...
...
@@ -9,6 +9,10 @@ export default {
},
props
:
{
type
:
String
,
needTitle
:
{
type
:
Boolean
,
default
:
false
},
action
:
{
type
:
String
,
required
:
true
...
...
@@ -85,21 +89,29 @@ export default {
this
.
$refs
.
input
.
value
=
null
;
if
(
!
this
.
beforeUpload
)
{
let
fileIndex
=
this
.
fileList
.
findIndex
(
o
=>
o
.
uid
===
rawFile
.
uid
);
let
file
=
this
.
fileList
[
fileIndex
];
let
filename
=
file
.
name
;
let
orgSuffix
=
rawFile
.
name
.
substring
(
rawFile
.
name
.
lastIndexOf
(
'
.
'
));
if
(
filename
.
indexOf
(
'
.
'
)
===
-
1
)
{
// 不存在文件类型后缀,补充原文件后缀
filename
=
file
.
name
+
orgSuffix
;
}
else
{
let
suffix
=
filename
.
substring
(
filename
.
lastIndexOf
(
'
.
'
));
if
(
suffix
!==
orgSuffix
)
{
// 文件类型后缀不相同,再补充原文件后缀
filename
=
filename
+
orgSuffix
;
return
this
.
post
(
rawFile
);
}
if
(
!
this
.
beforeUpload
)
{
if
(
this
.
needTitle
)
{
let
fileIndex
=
this
.
fileList
.
findIndex
(
o
=>
o
.
uid
===
rawFile
.
uid
);
let
file
=
this
.
fileList
[
fileIndex
];
let
filename
=
file
.
name
;
let
orgSuffix
=
rawFile
.
name
.
substring
(
rawFile
.
name
.
lastIndexOf
(
'
.
'
));
if
(
filename
.
indexOf
(
'
.
'
)
===
-
1
)
{
// 不存在文件类型后缀,补充原文件后缀
filename
=
file
.
name
+
orgSuffix
;
}
else
{
let
suffix
=
filename
.
substring
(
filename
.
lastIndexOf
(
'
.
'
));
if
(
suffix
!==
orgSuffix
)
{
// 文件类型后缀不相同,再补充原文件后缀
filename
=
filename
+
orgSuffix
;
}
}
return
this
.
post
(
rawFile
,
filename
,
fileIndex
);
}
else
{
return
this
.
post
(
rawFile
);
}
return
this
.
post
(
rawFile
,
filename
,
fileIndex
);
}
const
before
=
this
.
beforeUpload
(
rawFile
);
...
...
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