I finally gave up and wrote a for
loop to initialize a simple array of objects where each object has an incremented counter (id
) as an attribute of the object. In other words, I just want:
var sampleData = [{id: 1},{id: 2},...];
I was hoping for a compact syntax I could just put on my return statement.
let sampleData = [];
for (var p = 0; p < 25; p++){
sampleData.push({id: p});
}
return {
data: sampleData,
isLoading: true
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…