ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.1k stars 14.64k forks source link

[Bug Report] el-upload中slot不能获取到fileList进行slot插槽的重写 #20220

Open Tzyito opened 3 years ago

Tzyito commented 3 years ago

Element UI version

0.1.0

OS/Browsers version

win10

Vue version

2.5.22

Reproduction Link

https://elementui.github.io/issue-generator/#/zh-CN

Steps to reproduce

通过slot=”{file}“只能获取单文件,当多文件上传时,需要自定义上传列表时获取不到fileList

What is Expected?

希望能将fileList也暴露出来,做到更方便的自定义列表文件。

What is actually happening?

暴露出可操作的fileList

fengdanbailu commented 3 years ago

现在只能再remove和change时自己手动维护fileList

xut0793 commented 2 years ago

现在只能再remove和change时自己手动维护fileList

你可以通过定义一个ref指向el-upload组件, ,然后通过 this.$refs.uploadRef.uploadFiles 拿到内部维护的 fileList。

但是要注意里面 file 和 rawFile 区别。rawFile 上并没有维护文件状态 status

joelpro2 commented 2 years ago

i guess this would be a pretty small feature but very handy. I've looked into the code and this seems enough to me (note that it's just a proposal and not a definite PR) https://github.com/ElemeFE/element/pull/21733