我有如下所示的 JSON 数据:
[{"tabname":"orders","datagroups":[{"dataname":"ordersToday","datavalue":87},
{"dataname":"orders30Days","datavalue":305}]},{ "tabname":"second","datagroups":
[{"dataname":"Test","datavalue":17}]}]
我的转换文件如下所示:
var transformTabs =
{"tag":"div","id":"${tabname}","class":"tabContent","children":[
{ "tag":"div", "class":"数据组","children":[
{"tag":"div","id":"${dataname}","class":"dataContent","children":[
{ "tag":"div", "class":"data","children":[
{"tag":"p","html":"${dataname}-${datavalue}"}
]} ]} ]} ]}
由于某种原因,dataname 和 datavalue 没有被转换——这些值应该出现的地方没有出现任何内容。我使用您的构建器来创建转换。你能告诉我我错过了什么吗?
这是我在 JSON 编码之前的原始数据:
Array
(
[0] => Array
(
[tabname] => orders
[datagroups] => Array
(
[0] => Array
(
[dataname] => ordersToday
[datavalue] => 17
)
[1] => Array
(
[dataname] => orders30Days
[datavalue] => 43
)
)
)
[1] => Array
(
[tabname] => second
[datagroups] => Array
(
[0] => Array
(
[dataname] => Test
[datavalue] => 17
)
)
)
)