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

 

[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
, and
fileList
What is required is a list of objects

Sample error code:

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

Sample correct code:

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

 Tips: [Mini Program Cloud Development] Intermediate and advanced front-end interview question bank (1000+) (contact me in the mini program).
---------- Creation is not easy, thank you all, please support!

 

Guess you like

Origin blog.csdn.net/weixin_42981560/article/details/109727454