比如:
let row.file= 733877064390737700,600879614404113000,65206129836717030
数据处理为:
,'733877064390737700','600879614404113000','65206129836717030'
方法封装:
function addStrings(ids) {
let arr = ids.split(',');
let newArr = [];
arr.forEach(item => {
if (item) {
newArr.push(item);
}
});
let op = '';
for (let i = 0; i < newArr.length; i++) {
if (i == newArr.length - 1) {
op += `'${newArr[i]}'`;
} else {
op += `'${newArr[i]}',`;
}
}
if (op) {
return ',' + op;
} else {
return op;
}
}
let row.files2=this.addStrings(row.file)
console.log(row.files2)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34