问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 微信小程序 Bug map 客户端 6.7.3 2.3.2
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 () {
}
})
微信小程序开发问题解答
微信小程序开发者回答:
我希望地图在展示多个标记点的时候能够自动缩放视野以包含所有的点,最初我采用map的include-points属性来实现,发现工具上没有任何效果,真机上可以实现,但是其中有两个点处于地图可视范围的边缘,导致气泡有部分超出了屏幕,于是我尝试给map设置padding如下:
map{
微信小程序开发者回答:
你好,请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
本文网址:http://www.91bianli.com/weixinxiaochengxu/33139.html