demo.html
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<div id="AMap" class="page out" data-title="AMap插件">
<div id="amap-header"></div>
<div id="amap-a"></div>
</div>
<script>
require(["NavHeader", "AMap"], function(NavHeader, Map) {
var _u = require("mUtil");
var hasClsPicker = typeof clsPicker !== "undefined";
if(!hasClsPicker) {
new NavHeader({
el: "amap-header",
option: {
title:"AMap插件",
smallTitle:"amap"
}
}).render();
}
new Map({
el: "amap-a",
option: {
centerPoint: {
//地址: 如 '上海市闵行区联航路1188号' 或 '121.5330486597,31.0853962892'
address: '121.5329059287,31.0862410057',
//坐标类型 -1 中文地址 1:高德,腾讯地图类的坐标系。2:百度地图类的坐标系。3:gps类的坐标系
coordinateType: 2
},
//附加点设置
additionalPoint: {
enabled: true,
coordinateType: 2, //坐标类型 1:高德,腾讯地图类的坐标系。2:百度地图类的坐标系。3:gps类的坐标系
coordinates: function(point, callback){//附加点,数组或者函数
callback && callback([
{id:1, label: "浦江城市生活广场", lng:121.511639, lat:31.089019},
{id:2, label: "奇士国际广场", lng:121.526318, lat:31.091181},
{id:3, label: "浦江智汇园", lng:121.527756, lat:31.082102}
]);
},
showLabel: true,//显示名称
click: function(options){
Mobile_NS.msg(options.label);
}
},
height: function(){//默认值200
return $(document).height() - 61;
},
zoomLevel:15 //默认值15
}
}).render().then(function(){
if (!hasClsPicker) return;
_u.vetically("#map-a");
});
});
</script>