|
|
@@ -23,15 +23,21 @@
|
|
|
'getMenus',
|
|
|
param,
|
|
|
function(json,res){
|
|
|
- vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
|
+ var _menus = JSON.parse(json);
|
|
|
+ vm.menus = vm.refreshMenuActive(_menus,_menus[0].id);
|
|
|
},function(errInfo,error){
|
|
|
console.log('请求失败处理');
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
- refreshMenuActive:function(jsonArray,offset){
|
|
|
+ refreshMenuActive:function(jsonArray,_id){
|
|
|
for(var menuIndex =0 ; menuIndex < jsonArray.length;menuIndex ++){
|
|
|
- if(offset == menuIndex){
|
|
|
+ if(_id === jsonArray[menuIndex].id){
|
|
|
+ if(jsonArray[menuIndex].active === true){
|
|
|
+ //如果当前本身是打开状态,说明 需要关闭
|
|
|
+ jsonArray[menuIndex].active=false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
jsonArray[menuIndex].active=true;
|
|
|
continue;
|
|
|
}
|
|
|
@@ -39,8 +45,11 @@
|
|
|
}
|
|
|
|
|
|
return jsonArray;
|
|
|
+ },
|
|
|
+ switchMenu:function(_id){
|
|
|
+ vm.menus = vm.refreshMenuActive(vm.menus,_id);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
|
|
|
});
|
|
|
|