用js获取 model.addAttribute()存入的list

java

 List productionGroupList =getProductionGroupList();
 model.addAttribute("productionGroupLists",new Gson().toJson(productionGroupList));

js

var productionGroupListJson = '${productionGroupLists}';
            if(productionGroupListJson != ''){
                productionGroupListJson = JSON.parse(productionGroupListJson);
                console.log(productionGroupListJson);
                for(var p in productionGroupListJson){
                    if (upperId1==productionGroupListJson[p].pg_id){

                        $("#appdiv").show();
                    }else{
                        $("#appdiv").hide();
                    }
                }

            }

 

你可能感兴趣的:(layUI)