我想在容器加載完就顯示我自定義的幾個標識點,可是顯示不出來。。。附代碼
//model加載完畢顯示地圖
Model.prototype.modelLoad = function(event){
//顯示交通狀況
navigator.baiduMap.base.setTraffic(true);
var mapbox= this.getElementByXid('mapbox');
//放大地圖3D樓塊效果
navigator.baiduMap.base.setBuilding(true);
//設定百度地圖縮放等級
navigator.baiduMap.base.setZoomLevel(18);
navigator.baiduMap.base.zoomIn();
navigator.baiduMap.base.zoomOut();
//指南針
navigator.baiduMap.base.setCompass({"x":0,"y":98});
//打開地圖
navigator.baiduMap.base.open({
"position":{x:0,y:97,w:$(mapbox).width(),h:$(mapbox).height()},
"center":{lon:mylng,lat:mylat}
},function(){
alert("地圖加載完成!");
//顯示當前位置
navigator.baiduMap.base.showCurrentLocation({
isShow:true,
trackingMode:"none"
});
},callBack);
下面就是我定義的三個標識點,顯示不出來





navigator.baiduMap.base.addAnnotations([{
id:1,
title:"商店1",
subTitle:"位置在...",
lon:118.808000,
lat:31.972000,
draggable:false,
color:navigator.baiduMap.annotationColor.Red
},{
id:2,
title:"商店2",
subTitle:"位置在...",
lon:118.808700,
lat:31.972100,
draggable:false,
color:navigator.baiduMap.annotationColor.Purple
},{
id:3,
title:"商店3",
subTitle:"位置在...",
lon:118.808100,
lat:31.962125,
draggable:false,
color:navigator.baiduMap.annotationColor.Green
}],function(){
alert("添加成功!");
},callback);
}

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/119721.html
標籤:移動開發其他問題
上一篇:寫一個累死滴滴打車的軟體有多難?
