Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
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
lanbaoming
jiedao-app-operator-master
Commits
1dc62be1
Commit
1dc62be1
authored
Aug 08, 2022
by
dcy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
封装上传图片和视频
parent
6df8d884
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
index.vue
src/components/ImageAndVideoUpload/index.vue
+10
-10
No files found.
src/components/ImageAndVideoUpload/index.vue
View file @
1dc62be1
<
template
>
<
template
>
<div
class=
"component-upload-image"
>
<div
class=
"component-upload-image"
>
<div
style=
"display: flex;flex-wrap: wrap "
>
<div
style=
"display: flex;flex-wrap: wrap "
>
<div
v-for=
"(item, index) in fileList "
:key=
"index"
style=
"height: 148px; width:148px;
border:1px solid;margin:5px 10px
"
>
<div
v-for=
"(item, index) in fileList "
:key=
"index"
style=
"height: 148px; width:148px;
margin:5px 10px;position: relative;box-sizing: border-box;
"
>
<el-image
style=
"height: 148px; width:148px;"
fit=
"fit"
:src=
"item.url"
>
<el-image
@
click=
"dialogImageUrl = item.url; dialogVisible = true; "
style=
"height: 148px; width:148px;"
fit=
"fit"
:src=
"item.url"
>
<video
controls
width=
"148px"
height=
"148px"
slot=
"error"
:src=
"item.url"
></video>
<video
controls
width=
"148px"
height=
"148px"
slot=
"error"
:src=
"item.url"
></video>
</el-image>
</el-image>
<div
@
click=
"handleRemove(index)"
class=
"el-icon-error"
style=
"font-size: 25px;cursor: pointer;position: absolute;right: -10px; top: -10px"
></div>
</div>
</div>
<div>
<div>
<el-upload
<el-upload
...
@@ -15,7 +16,6 @@
...
@@ -15,7 +16,6 @@
:before-upload=
"handleBeforeUpload"
:before-upload=
"handleBeforeUpload"
:on-error=
"handleUploadError"
:on-error=
"handleUploadError"
name=
"file"
name=
"file"
:on-remove=
"handleRemove"
:show-file-list=
"false"
:show-file-list=
"false"
:headers=
"headers"
:headers=
"headers"
:on-preview=
"handlePictureCardPreview"
:on-preview=
"handlePictureCardPreview"
...
@@ -79,7 +79,7 @@ export default {
...
@@ -79,7 +79,7 @@ export default {
headers
:
{
headers
:
{
Authorization
:
"
Bearer
"
+
getToken
(),
Authorization
:
"
Bearer
"
+
getToken
(),
},
},
fileList
:
[]
fileList
:
[]
,
};
};
},
},
watch
:
{
watch
:
{
...
@@ -105,7 +105,8 @@ export default {
...
@@ -105,7 +105,8 @@ export default {
}
}
},
},
deep
:
true
,
deep
:
true
,
immediate
:
true
immediate
:
true
,
}
}
},
},
computed
:
{
computed
:
{
...
@@ -116,12 +117,10 @@ export default {
...
@@ -116,12 +117,10 @@ export default {
},
},
methods
:
{
methods
:
{
// 删除图片
// 删除图片
handleRemove
(
file
,
fileList
)
{
handleRemove
(
index
)
{
const
findex
=
this
.
fileList
.
map
(
f
=>
f
.
name
).
indexOf
(
file
.
name
);
this
.
fileList
.
splice
(
index
,
1
);
if
(
findex
>
-
1
)
{
this
.
fileList
.
splice
(
findex
,
1
);
this
.
$emit
(
"
input
"
,
this
.
listToString
(
this
.
fileList
));
this
.
$emit
(
"
input
"
,
this
.
listToString
(
this
.
fileList
));
}
},
},
// 上传成功回调
// 上传成功回调
handleUploadSuccess
(
res
)
{
handleUploadSuccess
(
res
)
{
...
@@ -202,6 +201,7 @@ export default {
...
@@ -202,6 +201,7 @@ export default {
opacity
:
0
;
opacity
:
0
;
transform
:
translateY
(
0
);
transform
:
translateY
(
0
);
}
}
</
style
>
</
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