fix(upload): file is set to null after upload failure, closes #1316

This commit is contained in:
07akioni 2021-10-17 19:43:56 +08:00
parent 23a7f24888
commit 134aa49ecd
17 changed files with 21 additions and 14 deletions

View File

@ -6,6 +6,7 @@
- Fix `n-collapse`'s expanded status is lost when using `v-if` with `n-collapse-item`, closes [#1387](https://github.com/TuSimple/naive-ui/issues/1387).
- Fix `n-dialog`'s close button will be overlayed with content, closes [#1381](https://github.com/TuSimple/naive-ui/issues/1381).
- Fix `n-upload` file is set to `null` after upload failure, closes [#1316](https://github.com/TuSimple/naive-ui/issues/1316).
### Feats

View File

@ -6,6 +6,7 @@
- 修复 `n-collapse``n-collapse-item` 使用 `v-if` 是展开状态丢失,关闭 [#1387](https://github.com/TuSimple/naive-ui/issues/1387)
- 修复 `n-dialog` 的关闭按钮会被内容遮盖,关闭 [#1381](https://github.com/TuSimple/naive-ui/issues/1381)
- 修复 `n-upload` 上传失败后重试时文件为 `null`,关闭 [#1316](https://github.com/TuSimple/naive-ui/issues/1316)
### Feats

View File

@ -1,4 +1,4 @@
# Custom Action
# Customize action
Sometimes you may want to customize `action` and `content` .

View File

@ -1,4 +1,4 @@
# Click on Mask
# Click on mask
I think user is smart enough that they know if nothing happens after mask is clicked, they should click at confirm or cancel button.

View File

@ -1,4 +1,4 @@
# Use as a Component
# Use as a component
Sometimes you may want to use a component.

View File

@ -1,4 +1,4 @@
# Split Trigger and List
# Split trigger and list
Set `abstract` on `n-upload`.

View File

@ -1,4 +1,4 @@
# Before Upload Hook
# Before upload hook
Use `before-upload` to prevent uploading.

View File

@ -1,4 +1,4 @@
# Controlled File List
# Controlled file list
Example is only a joke.

View File

@ -1,4 +1,4 @@
# Default File List
# Default file list
```html
<n-upload

View File

@ -1,4 +1,4 @@
# Drag to Upload
# Drag to upload
```html
<n-upload action="__HTTP__://www.mocky.io/v2/5e4bafc63100007100d8b70f">

View File

@ -1,4 +1,4 @@
# Pictures Wall
# Pictures wall
`list-type = "image-card"`.

View File

@ -1,4 +1,4 @@
# Thumbnail File List
# Thumbnail file list
`list-type = "image"`.

View File

@ -1,4 +1,4 @@
# Change File on Finish
# Change file on finish
You can change file's property when upload finishes.

View File

@ -1,4 +1,4 @@
# Uncontrolled Manually Submit
# Uncontrolled manually submit
You can use `submit` method to submit in uncontrolled manner. Also you can do it in controlled manner in another way.

View File

@ -15,6 +15,7 @@ before-upload
image-style
image-card-style
abstract
retry-debug
```
## API

View File

@ -0,0 +1,5 @@
# Retry debug
```html
<n-upload action="http://fake-api"><n-button>Upload</n-button></n-upload>
```

View File

@ -79,8 +79,7 @@ function createXhrHandlers (
handleXHRError (e) {
const fileAfterChange: FileInfo = Object.assign({}, file, {
status: 'error',
percentage,
file: null
percentage
})
XhrMap.delete(file.id)
doChange(fileAfterChange, e)