微信小程序内置map组件简单使用

wxml中:

<map 
	id="map" 
	longitude="{{longitude}}" 					//中心经度
	latitude="{{latitude}}"						//中心纬度
	scale="{{scale}}"  							//原始缩放级别,范围3-20
	markers="{{markers}}" 						//标记点
	show-location="{{showLocation}}"			//显示带有方向的当前定位点
	style="{{style}}"							//地图尺寸
	subkey="{{subkey}}" 						//map秘钥
></map>

js中:

data: {
	longitude: 107.3354900000,
	latitude: 33.8985700000,
	scale: 17,
	showLocation: true,
	subkey: "SS5BZ-YG23F-DHJJH-JJ4QS-SGN76-5SGIV",
	style: "width: 100%; height: 200px;",
	markers: [{
		id: 0,
		iconPath: "/images/zhishi.png",			//目的地指示标记图片
		longitude: 117.3354900000,
		latitude: 31.8985700000,
		width: 30,								//指示标记尺寸
		height: 30,
	}]
},

一般做个地址标记这样就可以了。

猜你喜欢

转载自blog.csdn.net/qq_38882327/article/details/91987173