mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
61 lines
1.5 KiB
Vue
61 lines
1.5 KiB
Vue
|
<template>
|
||
|
<el-upload action="#" list-type="picture-card" :auto-upload="false">
|
||
|
<template #default>
|
||
|
<i class="el-icon-plus"></i>
|
||
|
</template>
|
||
|
<template #file="{ file }">
|
||
|
<div>
|
||
|
<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>
|
||
|
</template>
|
||
|
</el-upload>
|
||
|
<el-dialog v-model="dialogVisible">
|
||
|
<img width="100%" :src="dialogImageUrl" alt="" />
|
||
|
</el-dialog>
|
||
|
</template>
|
||
|
<script lang="ts">
|
||
|
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>
|