【发布时间】:2020-01-18 15:18:14
【问题描述】:
我有以下按颜色和数量属性分组的数据。
var data = {
green: {
"1000": [
{ type: 'apple', color: 'green', quantity: 1000 },
{ type: 'grape', color: 'green', quantity: 1000 }
]
},
red: {
"2000": [
{ type: 'apple', color: 'red', quantity: 2000 }
],
"4000": [
{ type: 'grape', color: 'red', quantity: 4000 }
]
}
};
现在我想对这些数据进行分页。因此,如果页面大小等于 1 项,我的第一页将包含
{ type: 'apple', color: 'green', quantity: 1000 }
秒:
{ type: 'grape', color: 'green', quantity: 1000 }
等等。我怎么能这样做?提前致谢。
【问题讨论】:
标签: javascript arrays pagination