wuxw7
2019-03-22 cea7d1c682ea46f8b39efa9e9eb581374a316d1f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
    菜单 处理
**/
(function(vc){
    var vm = new Vue({
       el:'#menu-nav',
       data:{
           menus:[]
       },
       mounted:function(){
           this.getMenus();
       },
       methods:{
           getMenus:function(){
               var param = {
                   msg:this.message
               }
               //发送get请求
               vc.http.call('menu',
                            'getMenus',
                             param,
                             {
                                emulateJSON:true
                             },function(json){
                                vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                             },function(){
                                console.log('请求失败处理');
                             }
                           );
           },
           refreshMenuActive:function(jsonArray,offset){
                for(var menuIndex =0 ; menuIndex < jsonArray.length;menuIndex ++){
                    if(offset == menuIndex){
                        jsonArray[menuIndex].active=true;
                        continue;
                    }
                    jsonArray[menuIndex].active=false;
                }
 
                return  jsonArray;
           }
       }
 
    });
 
})(window.vc)