Skip to content

Commit 0de8a03

Browse files
authored
Upload: use uid as upload-list key (#13054)
* Upload: use uid as upload-list key * chore: fix code style
1 parent 9bbae74 commit 0de8a03

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/form/src/form.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@
8585
},
8686
clearValidate(props = []) {
8787
const fields = props.length
88-
? (typeof props === 'string'
89-
? this.fields.filter(field => props === field.prop)
90-
: this.fields.filter(field => props.indexOf(field.prop) > -1)
91-
)
92-
: this.fields;
88+
? (typeof props === 'string'
89+
? this.fields.filter(field => props === field.prop)
90+
: this.fields.filter(field => props.indexOf(field.prop) > -1)
91+
) : this.fields;
9392
fields.forEach(field => {
9493
field.clearValidate();
9594
});

packages/upload/src/upload-list.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
name="el-list"
1010
>
1111
<li
12-
v-for="(file, index) in files"
12+
v-for="file in files"
1313
:class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']"
14-
:key="index"
14+
:key="file.uid"
1515
tabindex="0"
1616
@keydown.delete="!disabled && $emit('remove', file)"
1717
@focus="focusing = true"
@@ -65,6 +65,9 @@
6565
import ElProgress from 'element-ui/packages/progress';
6666
6767
export default {
68+
69+
name: 'ElUploadList',
70+
6871
mixins: [Locale],
6972
7073
data() {

0 commit comments

Comments
 (0)