{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"layout":"border","border":"false","itemId":"viewport1"},"expanded":true,"children":[{"configs":{"itemId":"panel1","flat":"true","region":"center"},"expanded":true,"children":[],"type":"panel"}],"type":"viewport","events":{"afterrender":"function showMap() {\n  if (!window.BMap) {\n    Wb.warn('加载百度地图JS失败，请检查viewport1.afterrender事件中引用的百度地图JS地址是否正确。');\n    return;\n  }\n  var map = app.map = new BMap.Map(app.panel1.body.dom); // 创建Map实例\n  map.centerAndZoom(new BMap.Point(116.404, 39.915), 11); // 初始化地图,设置中心点坐标和地图级别\n  map.addControl(new BMap.MapTypeControl()); //添加地图类型控件\n  map.setCurrentCity(\"北京\"); // 设置地图显示的城市 此项是必须设置的\n  map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放\n  map.addEventListener('click', function(e) {\n    if (app.clickHandler)\n      app.clickHandler(e.point.lng, e.point.lat);\n  });\n}\n\n//如果已经加载地图直接显示\nif (window.BMap)\n  Ext.defer(showMap, 50); //延时加载\nelse {\n  //否则先加载地图类库\n  app.baiduMapCallback = 'baiduMap' + Wb.getId();\n  Wb[app.baiduMapCallback] = showMap; //提供全局回调函数句柄给百度url，该句柄在viewport1的destroy事件中删除\n  Wb.addLink([{\n    //百度地图JS采用了重定向，因此回调在url中添加\n    url: 'http://api.map.baidu.com/api?v=2.0&ak=95ad44a29b40029310097884cc23f51b&callback=Wb.' + app.baiduMapCallback,\n    type: 'js'\n  }]);\n}","destroy":"if (app.baiduMapCallback)\n  delete Wb[app.baiduMapCallback];"}}],"type":"module"}],"roles":{"demo":1},"title":"地图","iconCls":"web_icon","inframe":false,"pageLink":""}