[Vue warn]: Error in callback for watcher “fileList”: "TypeError: Cannot create property ‘uid’ on string ’
element组件里file-list里的数据类型和我所使用的类型不一致
正确代码:
- 先将图片转换成file-list需要的格式
// 将图片格式转换成file-list需要的格式
computed: {
imgFileList () {
return this.form.cover.images.map((imgURL, index) => {
return {
name: index + '.png',
url: imgURL
}
})
}
},
- 填写file-list的属性
<el-upload
:action="articlesURL"
name="image"
list-type="picture-card"
:on-success="successFn"
:limit="form.cover.type"
:file-list="imgFileList"
>