Socket
Socket
Sign inDemoInstall

m-gis-ui

Package Overview
Dependencies
1
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    m-gis-ui

A component library based on Gaode Map API


Version published
Weekly downloads
154
increased by62.11%
Maintainers
1
Created
Weekly downloads
 

Readme

Source
地图组件库的使用
  • 安装组件库

    npm install m-gis-ui
    
  • 引入组件库

    import { defineCustomElements } from 'm-gis-ui/loader'
    defineCustomElements()
    

    说明:在项目的入口文件中进行自定义组件的初始化

    如果需要支持 IE11Edge 浏览器,请参照如下配置:

    import { applyPolyfills, defineCustomElements } from 'test-components/loader';
    applyPolyfills().then(() => {
      defineCustomElements()
    })
    
  • 在 Vue 项目中使用

    组件的 参数以及事件的配置 均遵循项目基础库中 API 的定义方式进行使用

  • 在 React 项目中使用

    组件的 参数配置 遵循项目基础库中 API 的定义方式进行使用

    组件的 事件配置 通过 addEventListener 监听 事件名称 的方式进行使用

  • 注意事项

    通过组件的 事件配置 获取组件内部的回调数据,均需从事件对象 event 中获取 detail 属性

    组件通信参数中的 复杂数据类型(对象、数组) 都需要通过获取对象后进行传入,参照如下:

    document.querySelector('map-toolbar').actions = ['polygon']
    
工具栏组件
  • 组件使用

    <map-toolbar></map-toolbar>
    
  • 组件参数配置

    PropertyAttributeDescriptionTypeDefault
    actions--工具栏自定义操作配置项string[][]
    gis (required)gis地图基础库源对象anyundefined
    infoWindowContent--自定义信息窗体内容HTMLElementundefined
    isClearis-clear工具栏清空操作的显示状态booleanfalse
    mapInstance (required)map-instance地图实例anyundefined
    markerIconOptions--工具栏 Marker 图标配置项{}{}
    modemode工具栏视图模式:tile 平铺显示、tooltip 工具提示string'tooltip'
    offsetoffset组件距离相对容器的顶部偏移量number | string15
    operations--工具栏操作项源数据any[][]
    overlayOptions--工具栏鼠标绘制区域的风格配置项{}{}
    placementplacement工具栏显示位置:left、right、centerstring'right'
    visiblevisible组件显示状态booleanfalse
  • 组件事件通信

    EventDescriptionType
    drawEnd鼠标工具绘制覆盖物结束时触发的通信事件CustomEvent<any>
    loadDistrict点击加载行政区划时触发的通信事件CustomEvent<any>
  • 操作配置项类型说明

    操作名称说明
    district加载行政区划
    marker添加点数据
    polyline添加线数据
    polygon添加面数据
    circle添加圆形区域
    rectangle添加矩形区域
    lineAlongTheRoad沿路划线
    perimeterSearch周边搜索
    polySelect多边形选择
    distanceMeasurement距离量算
    areaMeasurement面积量算
    isochron等时圈
行政区划组件
  • 组件使用

    <map-district></map-district>
    
  • 组件参数配置

    PropertyAttributeDescriptionTypeDefault
    childrenAliaschildren-alias行政区划子节点字段别名string'children'
    codeAliascode-alias行政区划代码字段别名string'code'
    nameAliasname-alias行政区划名称字段别名string'name'
    source--行政区划源数据any[][]
    visiblevisible组件显示状态booleanfalse
  • 组件事件通信

    EventDescriptionType
    cancel点击取消时触发的通信事件CustomEvent<any>
    confirm点击确定时触发的通信事件CustomEvent<any>
工具栏编辑面板组件
  • 组件使用

    <map-toolbar-edit-panel></map-toolbar-edit-panel>
    
  • 组件参数配置

    PropertyAttributeDescriptionTypeDefault
    actionType (required)action-type工具栏操作类型stringundefined
    visiblevisible组件显示状态booleanfalse
  • 组件事件通信

    EventDescriptionType
    cancel点击取消时触发的通信事件CustomEvent<any>
    confirm点击确定时触发的通信事件CustomEvent<any>
等时圈组件
  • 组件使用

    <map-isochron></map-isochron>
    
  • 组件参数配置

    PropertyAttributeDescriptionTypeDefault
    titletitletitlestring
地图图例
  • 组件使用
 <map-legend></map-legend>
  • 组件配置

    参数名称说明类型是否必须默认值
    visible图例的展示状态Booleanfalsefalse
    dataMap图例数据Arraytrue[{label: '图例1', color: '#ff0', icon: 'http://...' }]
    bottom距底部的距离numberfalse40
    left距左边的距离numberfalse40
    height图例的高度numberfalse14
    width图例的宽度numberfalse14

Keywords

FAQs

Last updated on 20 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc