前端去掉截取后空字符串的元素

fileList = fileList.filter((item) => item != "");

this.tableData2.forEach((element) => {
if (element.productPhoto && element.productPhoto != undefined && element.productPhoto != "") {
try{
let fileList = element.productPhoto.split("|");
//去掉空字符的元素
fileList = fileList.filter((item) => item != "");
let newList = [];
this.$utils.toArray(fileList).forEach((item) => {
newList.push({ url: this.fileUrl + item, name: item });
});
element.productPhoto = newList;
}
catch(Exception)
{

}

}
});

posted @ 2022-08-09 14:00  江南小镇的一缕阳光  阅读(44)  评论(0)    收藏  举报