要求返回list,指定长度,不够用空对象代替

const pageSize = 10;
let list = [{ id: 1 }];
 
const fillItems = Array.from({ length: pageSize - list.length }, () => ({ isEmptyData: true }));

list = [...list, ...fillItems];
 
// 本身list长度1,要求长度10


posted @ 2025-08-18 11:18  Deer_Lin  阅读(6)  评论(0)    收藏  举报