组件: map
api:moveToLocation
微信版本号:7.0.4
基础库:2.8.0 及 以上
手机:ios 9.3.3
moveToLocation 定位只能定位到当前位置,不能定位到指定的位置
html:
< view class = "page-body" > < view class = "page-section page-section-gap" > < map id = "myMap" style = "width: 100%; height: 300px;" latitude = "{{latitude}}" longitude = "{{longitude}}" markers = "{{markers}}" show-location ></ map > </ view > < view class = "btn-area" > < button bindtap = "moveToLocation" class = "page-body-button" type = "primary" >定位</ button > </ view > </ view > |
js:
Page({ data: { latitude: 23.099994, longitude: 113.324520, markers: [{ id: 1, latitude: 23.099994, longitude: 113.324520, name: 'T.I.T 创意园' }] }, onReady: function (e) { this .mapCtx = wx.createMapContext( 'myMap' ) }, moveToLocation: function () { this .mapCtx.moveToLocation({ latitude: 23.099994, longitude: 113.324520 }) }, }) |
css:
.page-section-gap{ box-sizing: border-box; padding : 0 30 rpx; } .page-body-button { margin-bottom : 30 rpx; } |
请问下解决了吗,我也碰到类似问题
这个问题解决了吗 我也是无法定位到指定 坐标点
解决了吗
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)这个格式的