vue-baidu-map 不拖拽
时间: 2023-10-17 12:26:22 浏览: 164
要禁止vue-baidu-map的拖拽功能,你可以在Hello_BaiduMap.vue文件中添加以下代码:
```
<template>
<!-- 地图容器 -->
<baidu-map class="bm-view" :dragging="false">
</baidu-map>
</template>
```
在样式中,你可以设置地图容器的宽度和高度,例如:
```
<style>
/* BaiduMap 组件容器本身是一个空的块级元素,如果容器不定义高度,百度地图将渲染在一个高度为 0 不可见的容器内。 */
.bm-view {
width: 100%;
height: 300px;
}
</style>
```
通过在地图组件上添加`:dragging="false"`属性,你可以禁止拖拽功能。这样就可以实现vue-baidu-map的不拖拽效果了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [VUE使用百度地图(vue-baidu-map)](https://blog.csdn.net/songdancer/article/details/127674451)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [vue-baidu-map离线百度地图,并附带jar包免费下载百度瓦片数据](https://download.csdn.net/download/HZC961850356/82034496)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文