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

NUpload 组件 finsh 事件得到的 file 对象为 null #2975

Closed
hmingv opened this issue May 19, 2022 · 1 comment
Closed

NUpload 组件 finsh 事件得到的 file 对象为 null #2975

hmingv opened this issue May 19, 2022 · 1 comment
Labels
feature request New feature or request

Comments

@hmingv
Copy link

hmingv commented May 19, 2022

TuSimple/naive-ui version (版本)

2.29.0

Vue version (Vue 版本)

3.2.34

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

版本 101.0.4951.67(正式版本) (64 位)

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

Windows 10

Node version (Node 版本)

Reappearance link (重现链接)

https://codesandbox.io/embed/competent-margulis-c5jxhy?fontsize=14&hidenavigation=1&theme=dark

Reappearance steps (重现步骤)

上传接口,上传失败的情况下,接口返回数据。

API 响应为:
HTTP 状态码 200

通过 code 判断是否成功。

Expected results (期望的结果)

在 finish 事件中,得到 file 对象。
将 file 对象设置为任何 finish 状态,组件都不要清掉 file 对象,为了实现重新上传的功能。

code === 0 时,上传失败,重新上传

Actual results (实际的结果)

当 code === 0 时,上传失败,file 对象被清掉,无法重新上传(file = null)。

Remarks (补充说明)

在代码的 App.vue 组件中,有注释描述问题,请查阅。

此问题或许不算是BUG,但是一个可以优化的点。

建议:
由于 finish 事件方法会返回一个 file 对象,建议在返回 file 对象后,判断此对象的状态,如果状态是 finish,则清掉 file 对象,否则保留此对象。

@github-actions github-actions bot added the untriaged need to sort label May 19, 2022
@07akioni 07akioni added feature request New feature or request and removed untriaged need to sort labels May 22, 2022
@07akioni
Copy link
Collaborator

增加了一个 is-error-state 属性,用户可以自行判断 error 状态

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants