【vue-mapvgl】安装

vue-mapvgl是一些图层库,是依附于vue-bmap-gl的,需要同时安装vue-bmap-gl。

需求

技术点

官网地址:组件 | vue-mapvgl

gitee地址:vue-mapvgl: 百度地图mapvgl组件的vue2和vue3

安装

npm install vue-bmap-gl --save

npm install vue-mapvgl --save

实现

<template>
  <div class="bmap-wrapper">
    <el-bmap vid="bmapDemo" :zoom="zoom" :center="center" class="bmap-demo">
      <el-bmapv-view :lazy="300">
          <el-bmapv-point-layer :lazy="2000" :zoom-threshold="[12,15]" :color="color" :shape="shape" :blend="blend" :size="size" :data="data" :enable-picked="true" :auto-select="true" :on-click="(e)=>{clickMarker(e)}"></el-bmapv-point-layer>
      </el-bmapv-view>
    </el-bmap>
  </div>
</template>
 
<script>
export default {
  data () {
    return {
      count: 1,
      zoom: 14,
      center: [121.5273285, 31.21515044],
      color: '#f00',
      shape: 'circle', // 默认为圆形 circle ,可传 square 改为正方形
      blend: 'lighter',
      size: 60,
      data: [
        {
          geometry: {
            type: 'POINT',
            coordinates: [121.5273285, 31.21515044]
          },
          properties: {
            id: '1'
          }
        },
        {
          geometry: {
            type: 'POINT',
            coordinates: [121.5483395, 31.21515154]
          }
        }
      ]
    }
  },
  methods: {
    clickMarker(e){
        console.log(e);
    }
  }
}
</script>
 
<style>
.bmap-wrapper {
  width: 500px;
  height: 500px;
}
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宾果的救星

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值