效果图

<view class='container'>
<map id="map" longitude="{{lon}}" latitude="{{lat}}" scale="14" markers="{{markers}}"></map>
</view>
.container{
width: 750rpx;
height: 100%;
}
.container map{
width: 100%;
height: 100%;
}
Page({
data: {
lat: '',
lon: '',
markers: []
},
onLoad: function(options) {
console.log('options', options)
let that = this
let lat = options.lat
let lon = options.lon
console.log(options)
that.setData({
lat: lat,
lon: lon,
markers: [{
iconPath: "/img/img/weizhi.png", //图片
id: 0,
latitude: lat,
longitude: lon,
width: 25,
height: 25
}]
})
}
})
本文详细介绍了一个基于地图组件的应用实例,展示了如何使用地图组件在页面上显示特定位置,并通过经纬度参数动态更新地图显示区域,同时设置自定义图标作为标记。

6710

被折叠的 条评论
为什么被折叠?



