vueuse-bmap-vgl

Vue 3 composition API wrapper for Baidu MapVGL (百度地图GL 可视化图层库)
337
Install
npm install vueuse-bmap-vgl
Latest Version:1.0.0
Vue:3
License:MIT
Last Updated:Oct 9, 2026
Links: npm
Maintainer: istillku

vueuse-bmap-vgl

Vue 3 组合式 API (Composition API) 封装的百度地图 MapVGL 可视化库。

npm version license

特性

  • 🚀 高性能渲染:针对海量点/线/面要素进行浅层响应式优化,避免递归代理带来的主线程卡顿。
  • 👁 智能 View 调度:提供统一的 View 实例检索体系(显式传入 -> 祖先注入 -> 默认单例创建),完美保障各图层间的 renderOrder 层级顺序。
  • 🎯 开箱即用鼠标拾取:内置 usePick / 各图层方法,支持便捷获取鼠标悬停或点击命中的地理要素数据。
  • 💎 全量类型支持:内置完整的 TypeScript 类型声明与 JSDoc 注释。

安装

# npm
npm install vueuse-bmap-vgl vueuse-bmap-jsapi mapvgl vue

# pnpm
pnpm add vueuse-bmap-vgl vueuse-bmap-jsapi mapvgl vue

快速上手

<template>
  <div ref="container" style="width: 100%; height: 600px;" />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useBmap } from 'vueuse-bmap-jsapi'
import { useView, useIconLayer, useLineLayer, usePolygonLayer } from 'vueuse-bmap-vgl'

const { container } = useBmap()

// 1. 创建共享的 MapVGL View
const { view } = useView()

// 2. 挂载点标注图层
const { data: iconData, pick: pickIcon } = useIconLayer({
  view,
  renderOrder: 3,
  options: {
    width: 32,
    height: 32,
    offset: [0, -16],
  },
  data: [
    {
      geometry: { type: 'Point', coordinates: [116.404, 39.915] },
      properties: { icon: '/marker.png', title: '示例点位' },
    },
  ],
})
</script>

支持的图层 Hooks

  • useView: 创建或绑定 MapVGL 视图上下文
  • useIconLayer: 图标点图层
  • useLineLayer: 折线/飞线图层
  • usePolygonLayer: 多边形面图层
  • usePick: 全局地图要素鼠标拾取

License

MIT

Related Packages

vueuse-bmap-jsapi

Vue 3 composition API wrapper for Baidu Map JSAPI (百度地图GL)

462
vue3-bmapgl

基于百度地图 JavaScript GL 版 API 封装的 Vue3 组件库

589 2
vue-baidu-map

Baidu Map Component for Vue 2.0

123,184 2,400
vue-baidu-map-v3

Baidu Map Component for Vue 2.0

2,177 2,400
vue-bmap-jsapi3

Baidu Map Component for Vue 2.0

1,939 2,400

Version History

Version Released Vue License
1.0.0 ^3.0.0 MIT
Pre-releases (1)
Version Released License
0.0.0-stage