Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 5ec154e

Browse files
committed
调整样式
1 parent 1cf72f8 commit 5ec154e

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

lib/EleUploadFile.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="ele-upload-file">
33
<el-upload
44
:accept="accept"
55
:action="action"
@@ -16,6 +16,7 @@
1616
:on-success="handleUploadSuccess"
1717
:show-file-list="false"
1818
:withCredentials="withCredentials"
19+
class="ele-upload-file-uploader"
1920
ref="upload"
2021
v-if="!disabled"
2122
>
@@ -247,3 +248,9 @@ export default {
247248
}
248249
}
249250
</script>
251+
252+
<style>
253+
.ele-upload-file-uploader {
254+
margin-bottom: 5px;
255+
}
256+
</style>

lib/EleUploadList.vue

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
11
<template>
22
<transition-group
3-
class="ele-upload el-upload-list el-upload-list--text"
3+
class="ele-upload-file-list el-upload-list el-upload-list--text"
44
name="el-list"
55
tag="ul"
66
>
77
<li
8-
:class="['el-upload-list__item', 'is-' + file.status]"
98
:key="file.uid"
10-
class="el-upload-list__item"
9+
class="el-upload-list__item ele-upload-list__item-content"
1110
v-for="(file, index) in files"
1211
>
13-
<div class="ele-upload-list__item-content">
12+
<el-link
13+
:href="file.url"
14+
:underline="false"
15+
target="_blank"
16+
>
17+
<img
18+
:src="getExtension(file.name)"
19+
class="el-upload-list__item-content-name-icon"
20+
/>
21+
<span>{{file.name}}</span>
22+
</el-link>
23+
<div class="ele-upload-list__item-content-action">
1424
<el-link
15-
:href="file.url"
1625
:underline="false"
17-
target="_blank"
18-
>
19-
<img
20-
:src="getExtension(file.name)"
21-
class="el-upload-list__item-content-name-icon"
22-
/>
23-
<span>{{file.name}}</span>
24-
</el-link>
25-
<div class="ele-upload-list__item-content-action">
26-
<el-link
27-
:underline="false"
28-
v-if="isShowSize"
29-
>{{getSize(file.size)}}</el-link>
30-
<el-link
31-
:underline="false"
32-
@click="handleDownload(file)"
33-
v-if="isCanDownload"
34-
>下载</el-link>
35-
<el-link
36-
:underline="false"
37-
@click="handleDelete(index, file)"
38-
type="danger"
39-
v-if="!disabled && isCanDelete"
40-
>删除</el-link>
41-
</div>
26+
v-if="isShowSize"
27+
>{{getSize(file.size)}}</el-link>
28+
<el-link
29+
:underline="false"
30+
@click="handleDownload(file)"
31+
v-if="isCanDownload"
32+
>下载</el-link>
33+
<el-link
34+
:underline="false"
35+
@click="handleDelete(index, file)"
36+
type="danger"
37+
v-if="!disabled && isCanDelete"
38+
>删除</el-link>
4239
</div>
4340
</li>
4441
</transition-group>
@@ -114,21 +111,21 @@ export default {
114111
</script>
115112

116113
<style>
117-
.ele-upload .el-upload-list__item {
114+
.ele-upload-file-list .el-upload-list__item {
118115
border: 1px solid #e4e7ed;
119116
line-height: 2;
120-
margin-top: 10px;
117+
margin-bottom: 10px;
121118
position: relative;
122119
}
123120
124-
.ele-upload .ele-upload-list__item-content {
121+
.ele-upload-file-list .ele-upload-list__item-content {
125122
display: flex;
126123
justify-content: space-between;
127124
align-items: center;
128125
color: inherit;
129126
}
130127
131-
.ele-upload .el-upload-list__item-content-name-icon {
128+
.ele-upload-file-list .el-upload-list__item-content-name-icon {
132129
padding-left: 8px;
133130
padding-right: 5px;
134131
width: 20px;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-ele-upload-file",
33
"description": "对 element-ui upload 组件进一步封装, 使其更简单、易用",
4-
"version": "0.0.2",
4+
"version": "0.0.3",
55
"private": false,
66
"license": "MIT",
77
"scripts": {

0 commit comments

Comments
 (0)