mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
33 lines
698 B
Vue
33 lines
698 B
Vue
|
<template>
|
||
|
<el-upload
|
||
|
action="https://jsonplaceholder.typicode.com/posts/"
|
||
|
list-type="picture-card"
|
||
|
:on-preview="handlePictureCardPreview"
|
||
|
:on-remove="handleRemove"
|
||
|
>
|
||
|
<i class="el-icon-plus"></i>
|
||
|
</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,
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
handleRemove(file, fileList) {
|
||
|
console.log(file, fileList)
|
||
|
},
|
||
|
handlePictureCardPreview(file) {
|
||
|
this.dialogImageUrl = file.url
|
||
|
this.dialogVisible = true
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|