Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-purchase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张冬
web-purchase
Commits
67a0301e
Commit
67a0301e
authored
Nov 06, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件放上才显示
parent
8e5292e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
Upload.vue
src/components/Upload/Upload.vue
+17
-5
No files found.
src/components/Upload/Upload.vue
View file @
67a0301e
...
...
@@ -18,8 +18,12 @@
</div>
</el-upload>
<ul>
<li
class=
"flex link"
v-for=
"(item, index) in fileList"
:key=
"index"
>
<div
style=
"margin-right: 20px"
>
{{
item
.
name
}}
</div>
<li
class=
"flex-item link"
v-for=
"(item, index) in fileList"
:key=
"index"
>
<el-popover
placement=
"top-start"
title=
"文件名称"
width=
"500"
trigger=
"hover"
:content=
"item.name"
>
<div
class=
"upload"
slot=
"reference"
>
<a
:href=
"item.url"
target=
"_blank"
>
{{
item
.
name
}}
</a>
</div>
</el-popover>
<div
@
click=
"handleDelete(index, item)"
>
删除
</div>
</li>
</ul>
...
...
@@ -97,7 +101,7 @@ export default {
const
isLt2M
=
file
.
size
/
1024
/
1024
<
max
;
if
(
!
isLt2M
)
{
this
.
$message
.
error
(
`上传附件大小不能超过
${
max
}
MB!`
);
return
return
;
}
if
(
this
.
fileList
.
length
==
this
.
limit
)
{
this
.
$message
.
warning
(
`每次只能上传
${
this
.
limit
}
个文件`
);
...
...
@@ -107,7 +111,7 @@ export default {
let
objName
=
getFileNameUUID
();
// 调用 ali-oss 中的方法
put
(
`
${
objName
}${
file
.
name
}
`
,
file
).
then
((
res
)
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
;
this
.
fileList
.
push
(
res
);
this
.
emitInput
(
this
.
fileList
);
});
...
...
@@ -149,6 +153,14 @@ export default {
</
script
>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<
style
scoped
></
style
>
<
style
scoped
>
.upload
{
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
margin-right
:
30px
;
width
:
100px
;
}
</
style
>
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