Upload: use uid as upload-list key (#13054)

* Upload: use uid as upload-list key

* chore: fix code style
pull/12858/merge
hetech 2018-10-15 17:06:45 +08:00 committed by GitHub
parent 9bbae74cb6
commit 0de8a032c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -85,11 +85,10 @@
},
clearValidate(props = []) {
const fields = props.length
? (typeof props === 'string'
? this.fields.filter(field => props === field.prop)
: this.fields.filter(field => props.indexOf(field.prop) > -1)
)
: this.fields;
? (typeof props === 'string'
? this.fields.filter(field => props === field.prop)
: this.fields.filter(field => props.indexOf(field.prop) > -1)
) : this.fields;
fields.forEach(field => {
field.clearValidate();
});

View File

@ -9,9 +9,9 @@
name="el-list"
>
<li
v-for="(file, index) in files"
v-for="file in files"
:class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']"
:key="index"
:key="file.uid"
tabindex="0"
@keydown.delete="!disabled && $emit('remove', file)"
@focus="focusing = true"
@ -65,6 +65,9 @@
import ElProgress from 'element-ui/packages/progress';
export default {
name: 'ElUploadList',
mixins: [Locale],
data() {