vue百度地图插件
安装
npm i --save vue-baidu-map
<template>
<div>
<baidu-map v-bind:style="mapStyle" class="bm-view" ak="你的百度地图ak" :center="center" :zoom="zoom" :scroll-wheel-zoom="true"
@click="getClickInfo" @moving="syncCenterAndZoom" @moveend="syncCenterAndZoom" @zoomend="syncCenterAndZoom">
<bm-view style="width: 100%; height:500px;"></bm-view>
<bm-marker :position="{lng: center.lng, lat: center.lat}" :dragging="true" animation="BMAP_ANIMATION_BOUNCE">
</bm-marker>
<bm-control :offset="{width: '10px', height: '10px'}">
<bm-auto-complete v-model="keyword" :sugStyle="{zIndex: 999999}">
<input type="text" placeholder="请输入搜索关键字" class="serachinput">
</bm-auto-complete>
</bm-control>
<bm-local-search :keyword="keyword" :auto-viewport="true" style="width:0px;height:0px;overflow: hidden;"></bm-local-search>
</baidu-map>
</div>
</template>
<script> //地图组件---按需引入
import {BaiduMap, BmControl, BmView, BmAutoComplete, BmLocalSearch, BmMarker} from 'vue-baidu-map'
export default {
components: {
BaiduMap,
BmControl,
BmView,
BmAutoComplete,
BmLocalSearch,
BmMarker
},
data: function () {
return {
showMapComponent: this.value,
keyword: '',
mapStyle: {
width: '100%',
height: this.mapHeight + 'px'
},
center: {lng: 116.404, lat: 39.915},
zoom:
}
},
watch: {
value: function (currentValue) {
this.showMapComponent = currentValue
if (currentValue) {
this.keyword = ''
}
}
},
methods: {
/***
* 地图点击事件。
*/
getClickInfo (e) {
this.center.lng = e.point.lng
this.center.lat = e.point.lat
},
syncCenterAndZoom (e) {
const {lng, lat} = e.target.getCenter()
this.center.lng = lng
this.center.lat = lat
this.zoom = e.target.getZoom()
},
}
}
</script>
<style scoped>
.serachinput {
width: 300px;
box-sizing: border-box;
padding: 9px;
border: 1px solid #dddee1;
line-height: 20px;
font-size: 16px;
height: 38px;
color: #;
position: relative;
border-radius: 4px;
-webkit-box-shadow: # 0px 0px 10px;
-moz-box-shadow: # 0px 0px 10px;
box-shadow: # 0px 0px 10px;
}
</style>
vue百度地图插件的更多相关文章
- vue Baidu Map --- vue百度地图插件
vue Baidu Map 官网:https://dafrok.github.io/vue-baidu-map/#/zh/start/installation javascript 官网:http:/ ...
- 在ionic/cordova中使用百度地图插件
在ionic项目中,如果想实现定位功能,可以使用ng-cordova提供的cordova-plugin-geolocation. 但由于高墙的缘故,国内andorid环境下,此插件不起作用(ios环境 ...
- ionic1 添加百度地图插件 cordova-plugin-baidumaplocation
cordova-plugin-baidumaplocation 这个插件返回的数据是 json 格式的 可以直接获取 android 和 ios 都可用 1.先去百度地图平台去创建应用 获取访问 ...
- vue + 百度地图api
主要分解为如下步骤: (1)在html文件中引入百度地图, <script type="text/javascript" src="http://api.map.b ...
- ionic 项目使用百度地图插件(cordova-qdc-baidu-location)
现在我们使用'Weizhe He'提供的cordova-qdc-baidu-location来尝试创建简单的定位app. Stpe1:创建一个项目 Stpe2:申请百度地图API秘钥 应用类型 ...
- vue & 百度地图:使用百度地图
index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> &l ...
- vue 百度地图实现标记多个maker,并点击任意一个maker弹出对应的提示框信息, (附: 通过多个地址,标记多个marker 的 方法思路)
通过点击不同筛选条件,筛选出不同企业所在的地点, 根据每个企业的经纬度 在地图上标记多个maker,点击任意一个maker,会弹出infoWindow 信息窗口: 说明: 因每个人写法不同.需求不同 ...
- 百度地图插件(百度地图AK申请配置指南)
百度地图AK申请配置指南 [LBS云] 百度地图AK申请配置指南 1. 该文档是详细版,图文并茂: 2. 该指南是针对browser-mobile-sever三种终端开发的申请与配置说明: 3 ...
- vue 百度地图多标注展示和点击标注进行的提示
index.html中加入script <script type="text/javascript" src="http://api.map.baidu.com/a ...
随机推荐
- C语言中 if 和 else if 的区别
先看代码:我们本意是对i不同的值有不同的判断. #include<stdio.h> int main(void) { ; ) { i++; printf("%d\n", ...
- 机器学习基石11-Linear Models for Classification
注: 文章中所有的图片均来自台湾大学林轩田<机器学习基石>课程. 笔记原作者:红色石头 微信公众号:AI有道 上一节课,我们介绍了Logistic Regression问题,建立cross ...
- technologies
RPC Apache Thrift, Thrift is an interface definition language and binary communication protocol, lik ...
- SQL baseline_11g
conn sh/sh--执行想要创建基线的语句,语句的执行计划将会被缓存set autotrace on select /*ghbaselines1*/ count(*) from customers ...
- 大前端服务器渲染 发布和部署 Vue + vue(SSR)
https://blog.csdn.net/sinat_15951543/article/details/80109521 就是到服务器dist 下面 npm run start & 然 ...
- MySQL慢查询日志汇总
概念: MySQL的慢查询日志是MySQL提供的一种日志记录,它用来记录在MySQL中响应时间超过阀值的语句,具体指运行时间超过long_query_time值的SQL,则会被记录到慢查询日志中.lo ...
- HihoCoder - 1038 01背包 动态规划
#1038 : 01背包 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 且说上一周的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励 ...
- kubernets helm 如何删除tiller
https://stackoverflow.com/questions/53612553/how-to-uninstall-remove-tiller-from-kubernetes-manually ...
- 基于Hexo搭建个人博客网站
## 准备工作 首先下载[nodejs](https://nodejs.org/en/download/),一路next安装即可.验证是否安装成功: ```bash node -v # 输出 v1 ...
- Emsemble
RM # -*- coding: utf-8 -*- """ RandomForestClassifier 예 """ import pan ...