Showing
1 changed file
with
10 additions
and
2 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-05-19 14:54:27 | 2 | * @Date: 2023-05-19 14:54:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-11-06 10:53:45 | 4 | + * @LastEditTime: 2024-11-06 11:28:00 |
| 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue | 5 | * @FilePath: /map-demo/src/views/bieyuan/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -385,7 +385,15 @@ export default { | ... | @@ -385,7 +385,15 @@ export default { |
| 385 | $('.van-floating-panel').css('boxShadow', '0 0 15px black'); | 385 | $('.van-floating-panel').css('boxShadow', '0 0 15px black'); |
| 386 | 386 | ||
| 387 | // 定位到当前位置中心 | 387 | // 定位到当前位置中心 |
| 388 | - // this.map.setZoomAndCenter(this.zoom, this.itemInfo.position); | 388 | + this.map.setZoomAndCenter(this.zoom, this.itemInfo.position); |
| 389 | + // 获取地图容器的高度 | ||
| 390 | + const mapHeight = this.map.getSize().height; | ||
| 391 | + | ||
| 392 | + // 计算需要向上移动的像素值,比如向上移动地图高度的一半左右 | ||
| 393 | + const offsetY = -mapHeight / 3.5; | ||
| 394 | + | ||
| 395 | + // 使用 panBy 方法进行视图偏移 | ||
| 396 | + this.map.panBy(0, offsetY); | ||
| 389 | }) | 397 | }) |
| 390 | } | 398 | } |
| 391 | // TODO: 获取详情定位信息用来导航 | 399 | // TODO: 获取详情定位信息用来导航 | ... | ... |
-
Please register or login to post a comment