map.includePoints 的padding无效
<!-- .wxml –>
<map id=‘myMap’ longitude=‘{{longtitude}}’ latitude=‘{{latitude}}’ show-location scale=‘12’ markers=‘{{markers}}’ bindmarkertap=‘tapToShowCard’ bindcallouttap=‘tapToShowDetail’></map>
<!-- .js –>
var sourceMarker = [{
latitude: 24.508513,
longitude: 118.107597,
iconPath: ‘…/…/sources/marker.png’,
width: 22,
height: 30,
callout: {
content: ‘查看详情’,
fontSize: 16,
borderRadius: 5,
padding: 8,
display: ‘ALWAYS’
}
},{
latitude: 24.508439,
longitude: 118.10778,
iconPath: ‘…/…/sources/marker.png’,
width: 22,
height: 30,
callout: {
content: ‘查看详情’,
fontSize: 16,
borderRadius: 5,
padding: 8,
display: ‘ALWAYS’
}
},{
latitude: 24.5084,
longitude: 118.107168,
iconPath: ‘…/…/sources/marker.png’,
width: 22,
height: 30,
callout: {
content: ‘查看详情’,
fontSize: 16,
borderRadius: 5,
padding: 8,
display: ‘ALWAYS’
}
}]
Page({
/**
* 页面的初始数据
*/
data: {
latitude: 0,
longtitude: 0,
markers: sourceMarker,
points: sourcePoints
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
var that = this;
wx.getLocation({
success: function(res) {
that.setData({
latitude: res.latitude,
longtitude: res.longitude
})
that.mapCtx = wx.createMapContext(‘myMap’);
that.includePoints();
},
})
},
includePoints: function () {
this.mapCtx.includePoints({
padding: [20],
points: [{
latitude: 24.508513,
longitude: 118.107597,
}, {
latitude: 24.508439,
longitude: 118.10778,
}, {
latitude: 24.5084,
longitude: 118.107168,
}]
})
},
/**
* 生命周期函数–监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数–监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数–监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数–监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数–监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
