var config = (function($){
$.testConfig = {
contextPath:'http://localhost:8080/test',
maps:[
{id:'map1',url:'*********'},
{id:'map2',url:'*********'}
]
}
return $;
})(window.config||{});

 

配置文件的格式:var config = (function(){})( )

第一个小括号代表匿名函数,

第二个小括号代表参数,也就是说window.config||{}其实是匿名函数里面的$。

获取contextConfig:config.testConfig.contextConfig
获取map1中的url:   config.testConfig.maps[0].url

相关文章:

  • 2021-08-24
  • 2021-08-12
  • 2021-11-23
  • 2021-04-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-07-22
  • 2021-09-05
相关资源
相似解决方案