日期:2014-05-16 浏览次数:20305 次
//for test apply var src = {a:1,b:2,c:{c1:1,c2:2}}; var dest = {}; var defaultv = {cjd:'我'}; var res = Ext.apply(dest,src,defaultv); console.log(res); dest = {a:100}; var res1 = Ext.applyIf(dest,src); console.log(res1); //for test String format var arg1 = "我的",arg2="你的",arg3="我们的"; //这里的序号是从0开始递增的. var txt = String.format('{0}+{1}={2}',arg1,arg2,arg3);//我的+你的=我们的 console.log(txt); //for test extjs function interceptor function check(a){ return a==='cjd'; } function send(){ alert("pass"); } var fn = send.createInterceptor(check); fn('cjd');//alert pass //or var fn1 = send.createInterceptor(function(a){ return a==='cjd1'; }); fn1('cjd1');//alert pass