[Vue warn]: Error in callback for watcher “fileList”: “TypeError: Cannot create property ‘uid’ on string

The reason for the error:
TypeError: Cannot create property ‘xxx’ on string ‘xxxx’, this type of error is the type of assignment error ,
such as the above example error, when using the upload component of ElementUI, the string list is assigned to fileList, but fileList, What is required is a list of objects
Example error code:

pictureList = ['url1', 'url2'];
this.fileList = pictureList;

Example correct code:

pictureList = ['url1', 'url2'];
this.fileList = pictureList.map(item => {
       return {
         name: item,
         url: item
       }
});

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *