我有一个数组数组,我想在 a 中使用dom-repeat
,但是我收到一个错误,说数据不是数组。
dom-repeat.html:465 dom-repeat 预期数组
items
,找到 {0: Array(1), 1: Array(1), 2: Array(13)...
订单行项目中的原始数据正在转换为数组数组数据以排序成卡片。我认为理想情况下,模式应该是这样的:
卡父
<template is="dom-repeat" items="[[data]" index-as="index">
<card-item-group data="[[item]]"></card-item-group> -->
</template>
卡片儿童
<template is="dom-repeat" items="[[data]" index-as="index">
<card-items data="[[item]]"></card-items> -->
</template>
我是以错误的方式接近这个吗?
我可以通过其他方式将订单项合并到卡片中吗?
原始数据集:
[{
"0": {
"time": "2018-02-20",
"description": "Item 1",
"number": "1193312"
},
"1": {
"time": "2018-02-21",
"itemDesc": "Item 2",
"number": "1193314"
},
"2": {
"time": "2018-02-21",
"description": "Item 3",
"number": "1193314"
}
分组数据集:
[{
"0":[
{
"time": "2018-02-20",
"description": "Item 1",
"number": "1193312"
}
],
"1":[
{
"time": "2018-02-21",
"itemDesc": "Item 2",
"number": "1193314"
},{
"time": "2018-02-21",
"description": "Item 3",
"number": "1193314"
}
]
}]