Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload accept限制文件类型,通过按钮选文件有效, 拖拽无效!不会过滤,依然会加进list #2919

Closed
gowy222 opened this issue May 11, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@gowy222
Copy link

gowy222 commented May 11, 2022

TuSimple/naive-ui version (版本)

2.28.4

Vue version (Vue 版本)

3.2.33

Browser and its version (浏览器及其版本)

95内核

System and its version (系统及其版本)

win11家庭版

Node version (Node 版本)

Reappearance link (重现链接)

https://codesandbox.io/s/iq6y80
这是官方链接,请手动加上 accept=".pdf,application/pdf" 【哎...国内创建codesandbox样本网速可怜】

Reappearance steps (重现步骤)

<n-upload
ref="upload"
:default-upload="false"
multiple
@update:file-list="file_list_changed"
@remove="del_item"
class="fit"
accept=".pdf,application/pdf" //这里,拖拽方式需要在@update:file-list内部用代码控制过滤掉
:file-list="array_selected_files"

...

Expected results (期望的结果)

既然限制了pdf文件,不管按钮点击选文件,还是拖拽文件进入,都自动屏蔽掉其他文件到待上传list里面

Actual results (实际的结果)

拖拽文件,accept=".pdf,application/pdf" 没起作用.

Remarks (补充说明)

另外,
建议1: 加一个功能=>过滤重复文件,目前我这边手动代码控制去掉了用户多次选得同一个文件【文件名方式】。保证list文件唯一性.
最好能通过MD5去重,不过大文件需要分片chunk来计算,不然卡浏览器!

建议2: 开放上传list 的slot, 比如,我期望上传后重命名文件,自定义list就可以加个输入控件来编辑【上传后保存文件名】或者做成table,显示上传后得路径 + 新文件名 等等自定义功能

@github-actions github-actions bot added the untriaged need to sort label May 11, 2022
@07akioni 07akioni added bug Something isn't working and removed untriaged need to sort labels May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants