页面小东东记录

    1:利用json(json格式的配置文件)和jquery 实现根据配置的页面展示
        $.get("js/ymcfg.json", function (data) {
            parseinit(JSON.parse(data));
        },"json");
       
        var parseinit = function (jsonObj) {
            //可以将json对象进行遍历展现到页面
        }
   
   
    js的一些小东东综合:
   
         (1):js中数组的定义:var arr = [];
         
         (2):js中对象的定义:var goodArrmap = new Object();//Object类型在js中是个天然的map 用起来很方便
   
         (3):js中json对象的定义:var json = {};
         
         (4):js中将json对象转换为json字符串:JSON.stringify(json);
         
         (5) js数组中移除某一个元素可以使用下面的function:
               Array.prototype.baoremove = function(dx)
                 {
                    if(isNaN(dx)||dx>this.length){return false;}
                    this.splice(dx,1);
                 }
                如 arr.baoremove(2);
           
   附:ymcfg.json 的配置文件为:
    [ 
    {
        "id" : "searchType",
        "value" : "文档类型",
        "ifMultiSel" : "false",
        "Operator" : "in",
        "DataType" : "string",
        "typeItems" : [{
                "id" : "searchTypeNoLimit",
                "value" : "不限",
                "able" : "#resType,#proType"
            }, {
                "id" : "resReport",
                "value" : "word",
                "able" : "#resType;#proType",
                "disable" : "#resType(null);#proType(null)"
            }, {
                "id" : "appTool",
                "value" : "excle",
                "able" : "#resType(#resTypeNoLimit,#online_rpt);#proType(#proTypeNoLimit,#colligateBusi,#net)",
                "disable" : "#resType(#kpi_normal,#analysis,#cub,#cst,#report,#res_default,#sql,#view,#res_link,#pms_price,#pms_active,#tbl,#repository);#protype(#terminal,#famlymarket,#datamarket)"
            }
        ]
    },
    {
        "id" : "resType",
        "value" : "子类型",
        "ifMultiSel" : "true",
        "Operator" : "in",
        "DataType" : "string",
        "typeItems" : [{
                "id" : "resTypeNoLimit",
                "value" : "不限",
                "able" : "#proType"
            }, {
                "id" : "kpi_normal",
                "value" : "PPT",
                "able" : "#proType",
                "disable" : "#proType(null)"
            }
           
        ]
    },
    ]

 

附件中是一个实现页面动态配置的小例子。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值