//这是新菜单 从下面的旧菜单筛选出来的 请问怎么做成这样 //新菜单从旧菜单筛选出来的
var newMenuListJSonStr = [
{
"title": "实时监测",
"icon": "new/t-1",
"spread": true,
"children": [{
"title": "用能分布可视化",
"iconCls": "thirdLevelMenu/57",
"href": "energyMonitor/energyDistributionVisual"
}, {
"title": "变配电监测",
"icon": "thirdLevelMenu/56",
"href": "energyMonitor/byqSVGMonitor"
}]
}
];
//旧菜单
var oldData = [{
"iconCls": "new/t-1",
"id": "4754406",
"name": "实时监测",
"pid": "0",
"subFunctionMenuList": [
[{
"iconCls": "c_sbjb",
"id": "4754407",
"name": "能耗可视化管理",
"pid": "4754406",
"subFunctionMenuList": [
[{
"iconCls": "thirdLevelMenu/57",
"id": "4754408",
"name": "用能分布可视化",
"pid": "4754407",
"subFunctionMenuList": [
[
]
],
"url": "energyMonitor/energyDistributionVisual"
}, {
"iconCls": "thirdLevelMenu/56",
"id": "4754467",
"name": "变配电监测",
"pid": "4754407",
"subFunctionMenuList": [
[
]
],
"url": "energyMonitor/byqSVGMonitor"
}]
],
"url": "energyMonitor"
}]
],
"url": "/"
}];
9 回答
ExiaGo
TA贡献20条经验 获得超18个赞
谢邀请,我也没有筛选过 json 数据,我是这样想的,先创建一个空的对象,如:
var newMenuListJSonStr = [
{
"title" : "",
}
];
然后遍历旧的 json 数据,将旧数据赋值新的空对象
newMenuListJSonStr[0].title = oldData[0].name
newMenuListJSonStr[0].title //实时监测
看看别的大神是否这样做的?请告知。
添加回答
举报
0/150
提交
取消