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
002adf46
Commit
002adf46
authored
Jun 24, 2019
by
Victor Zhuk
Committed by
hetech
Jun 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload: add capability to customize thumbnail template (#13192)
parent
6f9ce3ac
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
324 additions
and
37 deletions
+324
-37
examples/docs/en-US/upload.md
examples/docs/en-US/upload.md
+69
-0
examples/docs/es/upload.md
examples/docs/es/upload.md
+69
-0
examples/docs/fr-FR/upload.md
examples/docs/fr-FR/upload.md
+69
-0
examples/docs/zh-CN/upload.md
examples/docs/zh-CN/upload.md
+69
-0
packages/upload/src/index.vue
packages/upload/src/index.vue
+9
-0
packages/upload/src/upload-list.vue
packages/upload/src/upload-list.vue
+39
-37
No files found.
examples/docs/en-US/upload.md
View file @
002adf46
...
...
@@ -154,6 +154,75 @@ Use `list-type` to change the fileList style.
```
:::
### Custom file thumbnail
Use
`scoped-slot`
to change default thumbnail template.
:::demo
```
html
<el-upload
action=
"#"
list-type=
"picture-card"
:auto-upload=
"false"
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"{file}"
>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
>
<span
class=
"el-upload-list__item-actions"
>
<span
class=
"el-upload-list__item-preview"
@
click=
"handlePictureCardPreview(file)"
>
<i
class=
"el-icon-zoom-in"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</div>
</el-upload>
<el-dialog
:visible.sync=
"dialogVisible"
>
<img
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
>
</el-dialog>
<script>
export
default
{
data
()
{
return
{
dialogImageUrl
:
''
,
dialogVisible
:
false
,
disabled
:
false
};
},
methods
:
{
handleRemove
(
file
)
{
console
.
log
(
file
);
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
this
.
dialogVisible
=
true
;
},
handleDownload
(
file
)
{
console
.
log
(
file
);
}
}
}
</script>
```
:::
### FileList with thumbnail
:::demo
...
...
examples/docs/es/upload.md
View file @
002adf46
...
...
@@ -150,6 +150,75 @@ Utilice la propiedad `list-type` para cambiar el estilo a un listado de archivos
```
:::
### Custom file thumbnail
Use
`scoped-slot`
to change default thumbnail template.
:::demo
```
html
<el-upload
action=
"#"
list-type=
"picture-card"
:auto-upload=
"false"
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"{file}"
>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
>
<span
class=
"el-upload-list__item-actions"
>
<span
class=
"el-upload-list__item-preview"
@
click=
"handlePictureCardPreview(file)"
>
<i
class=
"el-icon-zoom-in"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</div>
</el-upload>
<el-dialog
:visible.sync=
"dialogVisible"
>
<img
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
>
</el-dialog>
<script>
export
default
{
data
()
{
return
{
dialogImageUrl
:
''
,
dialogVisible
:
false
,
disabled
:
false
};
},
methods
:
{
handleRemove
(
file
)
{
console
.
log
(
file
);
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
this
.
dialogVisible
=
true
;
},
handleDownload
(
file
)
{
console
.
log
(
file
);
}
}
}
</script>
```
:::
### Lista de archivos con miniatura
:::demo
...
...
examples/docs/fr-FR/upload.md
View file @
002adf46
...
...
@@ -154,6 +154,75 @@ Utilisez `list-type` pour changer le style de la liste de fichiers.
```
:::
### Custom file thumbnail
Use
`scoped-slot`
to change default thumbnail template.
:::demo
```
html
<el-upload
action=
"#"
list-type=
"picture-card"
:auto-upload=
"false"
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"{file}"
>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
>
<span
class=
"el-upload-list__item-actions"
>
<span
class=
"el-upload-list__item-preview"
@
click=
"handlePictureCardPreview(file)"
>
<i
class=
"el-icon-zoom-in"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</div>
</el-upload>
<el-dialog
:visible.sync=
"dialogVisible"
>
<img
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
>
</el-dialog>
<script>
export
default
{
data
()
{
return
{
dialogImageUrl
:
''
,
dialogVisible
:
false
,
disabled
:
false
};
},
methods
:
{
handleRemove
(
file
)
{
console
.
log
(
file
);
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
this
.
dialogVisible
=
true
;
},
handleDownload
(
file
)
{
console
.
log
(
file
);
}
}
}
</script>
```
:::
### Liste de fichiers avec miniatures
:::demo
...
...
examples/docs/zh-CN/upload.md
View file @
002adf46
...
...
@@ -154,6 +154,75 @@
```
:::
### 文件缩略图
使用
`scoped-slot`
去设置缩略图模版。
:::demo
```
html
<el-upload
action=
"#"
list-type=
"picture-card"
:auto-upload=
"false"
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"{file}"
>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
>
<span
class=
"el-upload-list__item-actions"
>
<span
class=
"el-upload-list__item-preview"
@
click=
"handlePictureCardPreview(file)"
>
<i
class=
"el-icon-zoom-in"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
v-if=
"!disabled"
class=
"el-upload-list__item-delete"
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</div>
</el-upload>
<el-dialog
:visible.sync=
"dialogVisible"
>
<img
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
>
</el-dialog>
<script>
export
default
{
data
()
{
return
{
dialogImageUrl
:
''
,
dialogVisible
:
false
,
disabled
:
false
};
},
methods
:
{
handleRemove
(
file
)
{
console
.
log
(
file
);
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
this
.
dialogVisible
=
true
;
},
handleDownload
(
file
)
{
console
.
log
(
file
);
}
}
}
</script>
```
:::
### 图片列表缩略图
:::demo
...
...
packages/upload/src/index.vue
View file @
002adf46
...
...
@@ -276,6 +276,15 @@ export default {
files
=
{
this
.
uploadFiles
}
on
-
remove
=
{
this
.
handleRemove
}
handlePreview
=
{
this
.
onPreview
}
>
{
(
props
)
=>
{
if
(
this
.
$scopedSlots
.
file
)
{
return
this
.
$scopedSlots
.
file
({
file
:
props
.
file
});
}
}
}
<
/UploadList
>
);
}
...
...
packages/upload/src/upload-list.vue
View file @
002adf46
...
...
@@ -18,6 +18,7 @@
@
blur=
"focusing = false"
@
click=
"focusing = false"
>
<slot
:file=
"file"
>
<img
class=
"el-upload-list__item-thumbnail"
v-if=
"file.status !== 'uploading' && ['picture-card', 'picture'].indexOf(listType) > -1"
...
...
@@ -57,6 +58,7 @@
<i
class=
"el-icon-delete"
></i>
</span>
</span>
</slot>
</li>
</transition-group>
</
template
>
...
...
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