fix(components): [upload] two-way binding fileList (#8258)

This commit is contained in:
三咲智子
2022-06-17 15:01:30 +08:00
committed by GitHub
parent 9aa1632452
commit 73f48ae7a7
12 changed files with 59 additions and 60 deletions

View File

@ -1,14 +1,14 @@
<template>
<el-upload
v-model:file-list="fileList"
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
multiple
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList"
>
<el-button type="primary">Click to upload</el-button>
<template #tip>
@ -26,12 +26,12 @@ import type { UploadProps, UploadUserFile } from 'element-plus'
const fileList = ref<UploadUserFile[]>([
{
name: 'food.jpeg',
url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',
name: 'element-plus-logo.svg',
url: 'https://element-plus.org/images/element-plus-logo.svg',
},
{
name: 'food2.jpeg',
url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',
name: 'element-plus-logo2.svg',
url: 'https://element-plus.org/images/element-plus-logo.svg',
},
])