0.1.13 • Published 5 years ago

maplib2 v0.1.13

Weekly downloads
15
License
MIT
Repository
github
Last release
5 years ago

maplib2

CI License issues GitHub forks GitHub stars Vsersion

概述

文档,一个基于高德地图的线路展示React组件。

更便捷的完成地图展示的开发,不需要再学习高德的Api

起步

  1. 引入高德SDK 需要在页面中引入高德SDK文件,并修改为你的Key。
<!-- html部分添加 -->
<script src="https://webapi.amap.com/maps?v=1.4.15&key=你的key&plugin=AMap.Driving"></script>
  1. 安装
# use Npm
$ npm install maplib2

# or Yarn
$ yarn add maplib2
  1. 使用
import Maplib2 from 'maplib2'
import 'maplib2/dist/mapLine.min.css'

<Maplib2 {...options} />

代码演示

示例

import Maplib2 from 'maplib2'
import 'maplib2/dist/mapLine.min.css'

// 重庆--西安--郑州--济南--潍坊--青岛--潍坊
const path = [
        {
            iconText:'起',
            title:'重庆',
            LT:[106.550464,29.563761],
        },
        {
            iconText:'转',
            title:'西安',
            LT:[108.939621,34.343147],
        },
        {
            iconText:'支',
            title:'郑州',
            theme:6,
            LT:[116.438068,39.706265],
        },
        {
            iconText:'干',
            title:'潍坊',
            theme:8,
            LT:[119.107078,36.70925],
        },
        {
            iconText:'干',
            theme:9,
            LT:[120.374402,36.168923],
            title:'青岛'
        },
        {
            iconText:'终',
            title:'武汉',
            theme:12,
            LT:[114.30219,30.572921],
        },
    ]

const donePath = [
    {
        LT:[106.550464,29.563761],
    },
    {
        LT:[108.939621,34.343147],
    },
]

const options = {
    path,
    donePath,
    position:{
        show: true,
        LT: [108.939621,34.343147],
    },
}

export default () => <Maps {...options} />;

API

属性如下

参数说明类型默认值
path路径数据Array
pathColor路径颜色String#1890ff
donePath已完成路径Array
donePathColor已完成路径颜色String#bfbfbf
marker节点样式Object
anime轨迹回放Object
animeMarker获取回放节点动画对象Function
position当前位置Object

path

参数说明类型默认值
iconText图标文字String
titlemark文字String
LT坐标 经度,纬度Array
theme主题 1-12number随机分配

donePath

参数说明类型默认值
LT坐标 经度,纬度Array

marker

参数说明类型默认值
showmarker显示/隐藏Booleantrue
stylesmarker主题(暂未开放)String

anime

参数说明类型默认值
show显示/隐藏Booleantrue
icon节点图标String
pathColor回放后的路径颜色String#722ed1
type回放路径 pathdonePathStringpath

position

参数说明类型默认值
show显示/隐藏Booleantrue
icon节点图标String
LT坐标 经度,纬度Array

ToDoList

  • 隐藏展示配置
  • 颜色配置
  • 无途经点
  • 添加第一版文档
  • 发布npm
  • NPM 文档更新
  • TypeScript 类型抽出
  • 关键字搜索
  • Jest 测试用例增加 快照未生效,增加测试用例debug方式
  • 多条线路配置

Licensed

MIT.

0.1.13

5 years ago

0.1.12

5 years ago

0.1.10

5 years ago

0.1.11

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago