@baidumap/vue-bmap 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +271 -0
- package/dist/components/Control/index.d.ts +186 -0
- package/dist/components/Layer/index.d.ts +138 -0
- package/dist/components/Map/Map.d.ts +340 -0
- package/dist/components/Map/MapRef.d.ts +204 -0
- package/dist/components/Map/index.d.ts +4 -0
- package/dist/components/Overlay/InfoWindow.d.ts +193 -0
- package/dist/components/Overlay/index.d.ts +50 -0
- package/dist/components/Overlay/types.d.ts +799 -0
- package/dist/composables/index.d.ts +12 -0
- package/dist/composables/useCapabilities.d.ts +5 -0
- package/dist/composables/useDriver.d.ts +5 -0
- package/dist/composables/useGeocoder.d.ts +17 -0
- package/dist/composables/useIcon.d.ts +5 -0
- package/dist/composables/useMap.d.ts +8 -0
- package/dist/composables/useMapEvent.d.ts +4 -0
- package/dist/composables/useMapReady.d.ts +11 -0
- package/dist/composables/useMapRef.d.ts +8 -0
- package/dist/composables/useServiceTimeout.d.ts +7 -0
- package/dist/composables/useSymbol.d.ts +5 -0
- package/dist/const/index.d.ts +19 -0
- package/dist/constants/index.d.ts +195 -0
- package/dist/context/index.d.ts +31 -0
- package/dist/drivers/capabilityMatrix.d.ts +3 -0
- package/dist/drivers/createDriver.d.ts +18 -0
- package/dist/drivers/types.d.ts +359 -0
- package/dist/drivers/unsupported.d.ts +66 -0
- package/dist/drivers/v3Driver.d.ts +13 -0
- package/dist/drivers/v4Driver.d.ts +15 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +4121 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/registry.d.ts +13 -0
- package/dist/loader/stableHash.d.ts +2 -0
- package/dist/provider/BMapProvider.d.ts +108 -0
- package/dist/types/core.d.ts +82 -0
- package/dist/types/index.d.ts +111 -0
- package/dist/types/results.d.ts +171 -0
- package/dist/types-skd.d.ts +21 -0
- package/dist/utils/createComponent.d.ts +51 -0
- package/dist/utils/debugWarn.d.ts +22 -0
- package/dist/utils/event.d.ts +7 -0
- package/dist/utils/handle.d.ts +16 -0
- package/dist/utils/pointEquals.d.ts +7 -0
- package/dist/utils/sdk.d.ts +47 -0
- package/dist/utils/shallowEqual.d.ts +2 -0
- package/dist/utils/stableStringify.d.ts +10 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 百度地图数据智能前端
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Vue-BMap
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@baidumap/vue-bmap)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
用 Vue 3 组件写百度地图。地图、标注、覆盖物、控件都是普通的 Vue 组件,跟着响应式数据走,无需手动操作 DOM 或记 SDK 的命令式 API。一套代码同时支持百度地图 **JSAPI 3.0(2D)** 与 **4.0(WebGL)**,选项式(Options API)和组合式(Composition API)都能用。
|
|
7
|
+
|
|
8
|
+
```vue
|
|
9
|
+
<script setup>
|
|
10
|
+
import { BMapProvider, Map, Marker } from '@baidumap/vue-bmap';
|
|
11
|
+
const center = { lng: 116.404, lat: 39.915 };
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BMapProvider ak="您的密钥">
|
|
16
|
+
<Map :center="center" :zoom="12" style="height: 500px">
|
|
17
|
+
<Marker :position="center" />
|
|
18
|
+
</Map>
|
|
19
|
+
</BMapProvider>
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> 仅支持 Vue 3(`vue` 为 peer 依赖,`>=3.3`),不兼容 Vue 2。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @baidumap/vue-bmap
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
在 [百度地图开放平台](https://lbsyun.baidu.com/apiconsole/key) 申请一个浏览器端 `ak` 密钥即可,**不用**在 `index.html` 里手动加 `<script>`,组件库会自动加载地图脚本。
|
|
32
|
+
|
|
33
|
+
## 上手
|
|
34
|
+
|
|
35
|
+
### 1. 顶层放一个 Provider
|
|
36
|
+
|
|
37
|
+
`BMapProvider` 负责加载地图并把密钥、版本传下去,通常放在应用最外层,只写一次。
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<BMapProvider ak="您的密钥" version="4.0">
|
|
42
|
+
<App />
|
|
43
|
+
</BMapProvider>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- `version="4.0"`(默认):WebGL 三维地图,支持旋转、俯仰、3D。
|
|
48
|
+
- `version="3.0"`:传统 2D 地图,更轻量。
|
|
49
|
+
|
|
50
|
+
### 2. 放一张地图
|
|
51
|
+
|
|
52
|
+
`Map` 必须有确定的宽高,容器没高度会看不到地图。中心/缩放有两种写法:
|
|
53
|
+
|
|
54
|
+
- 非受控:`:default-center` / `:default-zoom`,只用作初始值,之后地图自己维护。
|
|
55
|
+
- 受控:`:center` / `:zoom`,跟随数据变化,改数据地图就动。
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<template>
|
|
59
|
+
<Map :center="{ lng: 116.404, lat: 39.915 }" :zoom="12" style="height: 500px" />
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. 往地图里塞东西
|
|
64
|
+
|
|
65
|
+
覆盖物、控件都作为 `Map` 的子元素:
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<Map :center="center" :zoom="12" style="height: 500px">
|
|
70
|
+
<Marker :position="center" />
|
|
71
|
+
<InfoWindow :position="center" content="天安门" />
|
|
72
|
+
<NavigationControl />
|
|
73
|
+
<ScaleControl />
|
|
74
|
+
</Map>
|
|
75
|
+
</template>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 常见用法
|
|
79
|
+
|
|
80
|
+
### 点击地图 / 标注
|
|
81
|
+
|
|
82
|
+
地图与覆盖物的事件用 `@` 监听(等价于 `:on-click` 函数 prop),点击回调会拿到经纬度:
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<template>
|
|
86
|
+
<Map :center="center" :zoom="12" style="height: 500px" @click="e => console.log('点了地图', e.point)">
|
|
87
|
+
<Marker :position="center" @click="point => console.log('点了标注', point)" />
|
|
88
|
+
</Map>
|
|
89
|
+
</template>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 用数据驱动标注
|
|
93
|
+
|
|
94
|
+
标注就是数据的映射,增删改直接改响应式数据:
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<script setup>
|
|
98
|
+
import { ref } from 'vue';
|
|
99
|
+
import { Map, Marker } from '@baidumap/vue-bmap';
|
|
100
|
+
|
|
101
|
+
const center = { lng: 116.404, lat: 39.915 };
|
|
102
|
+
const points = ref([center]);
|
|
103
|
+
const addPoint = e => points.value.push(e.point);
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<Map :center="center" :zoom="12" style="height: 500px" @click="addPoint">
|
|
108
|
+
<Marker v-for="(p, i) in points" :key="i" :position="p" />
|
|
109
|
+
</Map>
|
|
110
|
+
</template>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 画线、画圆
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<template>
|
|
117
|
+
<Map :center="center" :zoom="12" style="height: 500px">
|
|
118
|
+
<Polyline
|
|
119
|
+
:path="[{ lng: 116.399, lat: 39.910 }, { lng: 116.405, lat: 39.920 }]"
|
|
120
|
+
stroke-color="#3388ff" :stroke-weight="4"
|
|
121
|
+
/>
|
|
122
|
+
<Circle :center="center" :radius="800" fill-color="#3388ff" :fill-opacity="0.3" />
|
|
123
|
+
</Map>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 自定义标注图标
|
|
128
|
+
|
|
129
|
+
```vue
|
|
130
|
+
<template>
|
|
131
|
+
<Marker :position="center" :icon="{ url: '/pin.png', size: { width: 32, height: 32 } }" />
|
|
132
|
+
</template>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 地址转坐标(地理编码)
|
|
136
|
+
|
|
137
|
+
检索类功能以组合式函数(composable)提供,返回强类型结果:
|
|
138
|
+
|
|
139
|
+
```vue
|
|
140
|
+
<script setup>
|
|
141
|
+
import { useGeocoder } from '@baidumap/vue-bmap';
|
|
142
|
+
|
|
143
|
+
const { getPoint, getLocation, data } = useGeocoder();
|
|
144
|
+
getPoint('北京市海淀区上地十街10号'); // 地址转坐标,data.value.point 即坐标
|
|
145
|
+
// getLocation({ lng: 116.404, lat: 39.915 }); // 反向:坐标转地址
|
|
146
|
+
</script>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
> `useGeocoder` 必须在 `<Map>` 内部的组件中调用(依赖地图上下文)。
|
|
150
|
+
|
|
151
|
+
## 命令式操作地图
|
|
152
|
+
|
|
153
|
+
需要主动控制地图(飞到某点、缩放、坐标转换等)时,用 `useMapRef()` 拿到命令式句柄——它是响应式的,地图就绪后自动可用:
|
|
154
|
+
|
|
155
|
+
```vue
|
|
156
|
+
<script setup>
|
|
157
|
+
import { Map, useMapRef } from '@baidumap/vue-bmap';
|
|
158
|
+
|
|
159
|
+
const center = { lng: 116.404, lat: 39.915 };
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<template>
|
|
163
|
+
<Map :center="center" :zoom="12" style="height: 500px">
|
|
164
|
+
<Toolbar />
|
|
165
|
+
</Map>
|
|
166
|
+
</template>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```vue
|
|
170
|
+
<!-- Toolbar.vue:作为 <Map> 的子组件,才能读到地图上下文 -->
|
|
171
|
+
<script setup>
|
|
172
|
+
import { useMapRef } from '@baidumap/vue-bmap';
|
|
173
|
+
const map = useMapRef();
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<template>
|
|
177
|
+
<div class="toolbar">
|
|
178
|
+
<button @click="map?.panTo({ lng: 116.404, lat: 39.915 })">回到中心</button>
|
|
179
|
+
<button @click="map?.setZoom(15)">放大</button>
|
|
180
|
+
</div>
|
|
181
|
+
</template>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
也可以给 `<Map>` 一个模板 ref,通过 `getMapRef()` 取句柄:`mapEl.value.getMapRef()?.panTo(...)`。
|
|
185
|
+
|
|
186
|
+
句柄提供了地图的全量方法:`panTo` / `setZoom` / `setViewport` / `getBounds` / `pointToPixel` 等。
|
|
187
|
+
|
|
188
|
+
## 组合式函数(Composables)
|
|
189
|
+
|
|
190
|
+
从顶层直接 import,均需在 `<Map>` 内部使用:
|
|
191
|
+
|
|
192
|
+
- `useMap`、`useMapEvent`、`useMapReady`、`useDriver`、`useMapRef`、`useCapabilities`、`useSymbol`、`useIcon`、`useGeocoder`
|
|
193
|
+
|
|
194
|
+
`useCapabilities()` 返回当前地图版本支持的能力集合(响应式),可用于提前分支:
|
|
195
|
+
|
|
196
|
+
```vue
|
|
197
|
+
<script setup>
|
|
198
|
+
import { useCapabilities } from '@baidumap/vue-bmap';
|
|
199
|
+
const caps = useCapabilities();
|
|
200
|
+
// caps.value.has('Marker3D')
|
|
201
|
+
</script>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 能用哪些组件
|
|
205
|
+
|
|
206
|
+
从 `@baidumap/vue-bmap` 顶层直接 import,每个组件都带 TypeScript 类型。
|
|
207
|
+
|
|
208
|
+
- **覆盖物**:`Marker`、`Label`、`Polyline`、`Polygon`、`Circle`、`Rectangle`、`BezierCurve`、`Prism`、`GroundOverlay`、`GroundPoint`、`PointCollection`、`InfoWindow`、`Symbol`、`Icon`、`IconSequence`、`Hotspot`、`Marker3D`
|
|
209
|
+
- **控件**:`NavigationControl`、`NavigationControl3D`、`ScaleControl`、`OverviewMapControl`、`MapTypeControl`、`CopyrightControl`、`GeolocationControl`、`PanoramaControl`、`ZoomControl`、`CityListControl`、`LocationControl`、`LogoControl`
|
|
210
|
+
- **图层**:`TileLayer`、`NormalLayer`、`GeoJSONLayer`、`DistrictLayer`、`TrafficLayer`、`CustomLayer`、`CanvasLayer`、`RasterTileLayer`、`WMSLayer`、`WMTSLayer`、`XYZLayer`、`MVTLayer`
|
|
211
|
+
|
|
212
|
+
> 部分组件只在 4.0(WebGL)下可用(如 `Prism`、`Marker3D`、`DistrictLayer`)。在不支持的版本使用时,默认会打印一条警告并跳过,不会让页面崩溃。
|
|
213
|
+
|
|
214
|
+
## 命名约定与冲突处理
|
|
215
|
+
|
|
216
|
+
组件默认以 **PascalCase** 使用(`<Marker />`、`<LogoControl />`),这是 Vue 3 单文件组件的推荐写法,也和 import 名一一对应。库里同时兼容 kebab-case,但有两点需要留意:
|
|
217
|
+
|
|
218
|
+
### kebab-case 与原生标签冲突
|
|
219
|
+
|
|
220
|
+
在单文件组件(SFC)里 `<Marker />` 与 `<marker />` 编译等价。但部分组件是单词名,且与真实的 **SVG/HTML 元素同名**:`Marker`、`Circle`、`Polygon`、`Polyline`、`Label`、`Symbol`、`Rectangle`。
|
|
221
|
+
|
|
222
|
+
- 用 PascalCase(`<Marker />`):编译器按 import 名解析,无歧义,**推荐**。
|
|
223
|
+
- 用 kebab-case(`<marker />`)或写在 in-DOM 模板里:会和原生 `<marker>`/`<circle>` 等标签混淆,请通过 import 别名加前缀规避:
|
|
224
|
+
|
|
225
|
+
```vue
|
|
226
|
+
<script setup>
|
|
227
|
+
import { Marker as BmapMarker, Circle as BmapCircle } from '@baidumap/vue-bmap';
|
|
228
|
+
</script>
|
|
229
|
+
|
|
230
|
+
<template>
|
|
231
|
+
<bmap-marker :position="center" />
|
|
232
|
+
<bmap-circle :center="center" :radius="800" />
|
|
233
|
+
</template>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
> 注意大小写映射:别名取 `BmapMarker`(把 Bmap 当一个词)才对应 `<bmap-marker>`;若取 `BMapMarker`,Vue 生成的 kebab 标签是 `<b-map-marker>`。
|
|
237
|
+
|
|
238
|
+
### `Map` / `Symbol` 会遮蔽同名全局对象
|
|
239
|
+
|
|
240
|
+
组件 `Map`、`Symbol` 与 JS 全局的 `Map`、`Symbol` 同名。如果在同一个 `<script setup>` 里既 import 了组件又要用原生 `new Map()` / `Symbol()`,请给组件起别名避免遮蔽:
|
|
241
|
+
|
|
242
|
+
```vue
|
|
243
|
+
<script setup>
|
|
244
|
+
import { Map as BMapMap } from '@baidumap/vue-bmap';
|
|
245
|
+
const cache = new Map(); // 原生 Map 不受影响
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
<template>
|
|
249
|
+
<BMapMap :center="center" :zoom="12" style="height: 500px" />
|
|
250
|
+
</template>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 常见问题
|
|
254
|
+
|
|
255
|
+
**地图不显示?** 检查 `Map` 的容器是否有明确的宽高,`ak` 是否有效、是否配置了域名白名单。
|
|
256
|
+
|
|
257
|
+
**报错「只能加载一个版本」?** 同一个页面只能加载一个 JSAPI 版本,确保只有一个 `BMapProvider`,且 `version` 保持一致。
|
|
258
|
+
|
|
259
|
+
## 本地开发
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
npm install
|
|
263
|
+
npm run examples # 组件交互示例 + API 表格
|
|
264
|
+
npm run test:manual # 逐组件的手动测试页
|
|
265
|
+
npm run build # 打包(ESM + CJS + d.ts)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 许可证
|
|
269
|
+
|
|
270
|
+
[MIT](./LICENSE)
|
|
271
|
+
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Bounds, Size, OverlayHandle } from '../../types';
|
|
2
|
+
import { ControlAnchor, LengthUnit, MapTypeControlType, NavigationControlType } from '../../constants';
|
|
3
|
+
import { PlainIcon } from '../Overlay/types';
|
|
4
|
+
|
|
5
|
+
interface ControlReactProps {
|
|
6
|
+
/** 控制控件显示/隐藏。undefined 或 true = 显示,false = 隐藏 */
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NavigationControlOptions {
|
|
10
|
+
anchor?: ControlAnchor;
|
|
11
|
+
offset?: Size;
|
|
12
|
+
type?: NavigationControlType;
|
|
13
|
+
showZoomInfo?: boolean;
|
|
14
|
+
enableGeolocation?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface NavigationControl3DOptions {
|
|
17
|
+
anchor?: ControlAnchor;
|
|
18
|
+
offset?: Size;
|
|
19
|
+
}
|
|
20
|
+
export interface ScaleControlOptions {
|
|
21
|
+
anchor?: ControlAnchor;
|
|
22
|
+
offset?: Size;
|
|
23
|
+
/** 比例尺单位制,走 setUnit() */
|
|
24
|
+
unit?: LengthUnit;
|
|
25
|
+
}
|
|
26
|
+
export interface OverviewMapControlOptions {
|
|
27
|
+
anchor?: ControlAnchor;
|
|
28
|
+
offset?: Size;
|
|
29
|
+
size?: Size;
|
|
30
|
+
isOpen?: boolean;
|
|
31
|
+
zoomInterval?: number;
|
|
32
|
+
padding?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface MapTypeControlOptions {
|
|
35
|
+
anchor?: ControlAnchor;
|
|
36
|
+
offset?: Size;
|
|
37
|
+
type?: MapTypeControlType;
|
|
38
|
+
mapTypes?: unknown[];
|
|
39
|
+
enableSwitch?: boolean;
|
|
40
|
+
/** 是否显示路网层,走 showStreetLayer() */
|
|
41
|
+
showStreetLayer?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface CopyrightItem {
|
|
44
|
+
id: number;
|
|
45
|
+
content?: string;
|
|
46
|
+
bounds?: Bounds;
|
|
47
|
+
}
|
|
48
|
+
export interface CopyrightControlOptions {
|
|
49
|
+
anchor?: ControlAnchor;
|
|
50
|
+
offset?: Size;
|
|
51
|
+
/** 自定义版权信息,创建和更新时调用 addCopyright() */
|
|
52
|
+
copyrights?: CopyrightItem[];
|
|
53
|
+
}
|
|
54
|
+
export interface GeolocationControlOptions {
|
|
55
|
+
anchor?: ControlAnchor;
|
|
56
|
+
offset?: Size;
|
|
57
|
+
showAddressBar?: boolean;
|
|
58
|
+
enableAutoLocation?: boolean;
|
|
59
|
+
locationIcon?: PlainIcon | OverlayHandle;
|
|
60
|
+
watchPosition?: boolean;
|
|
61
|
+
useCompass?: boolean;
|
|
62
|
+
autoZoom?: boolean;
|
|
63
|
+
autoViewport?: boolean;
|
|
64
|
+
/** @since 4.0 定位前回调;返回 false 可阻止默认定位 */
|
|
65
|
+
onLocationStart?: (onSuccess: Function, onFail: Function) => boolean | void;
|
|
66
|
+
}
|
|
67
|
+
export interface PanoramaControlOptions {
|
|
68
|
+
anchor?: ControlAnchor;
|
|
69
|
+
offset?: Size;
|
|
70
|
+
}
|
|
71
|
+
export interface ZoomControlOptions {
|
|
72
|
+
anchor?: ControlAnchor;
|
|
73
|
+
offset?: Size;
|
|
74
|
+
}
|
|
75
|
+
export interface CityListControlOptions {
|
|
76
|
+
anchor?: ControlAnchor;
|
|
77
|
+
offset?: Size;
|
|
78
|
+
expand?: boolean;
|
|
79
|
+
/** @since 4.0 自定义触发元素 */
|
|
80
|
+
trigger?: HTMLElement;
|
|
81
|
+
onChangeBefore?: () => void;
|
|
82
|
+
onChangeAfter?: () => void;
|
|
83
|
+
onChangeSuccess?: (poi: {
|
|
84
|
+
city: string;
|
|
85
|
+
code: string | number;
|
|
86
|
+
}) => void;
|
|
87
|
+
/** @since 4.0 */
|
|
88
|
+
onOpen?: () => void;
|
|
89
|
+
/** @since 4.0 */
|
|
90
|
+
onClose?: () => void;
|
|
91
|
+
canCheckSize?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export type LocationControlOptions = GeolocationControlOptions;
|
|
94
|
+
export interface LogoControlOptions {
|
|
95
|
+
anchor?: ControlAnchor;
|
|
96
|
+
offset?: Size;
|
|
97
|
+
}
|
|
98
|
+
export interface NavigationControlProps extends NavigationControlOptions, ControlReactProps {
|
|
99
|
+
}
|
|
100
|
+
export interface NavigationControl3DProps extends NavigationControl3DOptions, ControlReactProps {
|
|
101
|
+
}
|
|
102
|
+
export interface ScaleControlProps extends ScaleControlOptions, ControlReactProps {
|
|
103
|
+
}
|
|
104
|
+
export interface OverviewMapControlProps extends OverviewMapControlOptions, ControlReactProps {
|
|
105
|
+
onViewChanged?: (raw: unknown) => void;
|
|
106
|
+
onViewChanging?: (raw: unknown) => void;
|
|
107
|
+
onResize?: (raw: unknown) => void;
|
|
108
|
+
}
|
|
109
|
+
export interface MapTypeControlProps extends MapTypeControlOptions, ControlReactProps {
|
|
110
|
+
}
|
|
111
|
+
export interface CopyrightControlProps extends CopyrightControlOptions, ControlReactProps {
|
|
112
|
+
}
|
|
113
|
+
export interface GeolocationControlProps extends GeolocationControlOptions, ControlReactProps {
|
|
114
|
+
onLocationSuccess?: (raw: unknown) => void;
|
|
115
|
+
onLocationError?: (raw: unknown) => void;
|
|
116
|
+
}
|
|
117
|
+
export interface PanoramaControlProps extends PanoramaControlOptions, ControlReactProps {
|
|
118
|
+
}
|
|
119
|
+
export interface ZoomControlProps extends ZoomControlOptions, ControlReactProps {
|
|
120
|
+
}
|
|
121
|
+
export interface CityListControlProps extends CityListControlOptions, ControlReactProps {
|
|
122
|
+
}
|
|
123
|
+
export type LocationControlProps = GeolocationControlProps;
|
|
124
|
+
export interface LogoControlProps extends LogoControlOptions, ControlReactProps {
|
|
125
|
+
}
|
|
126
|
+
export declare const NavigationControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
127
|
+
[key: string]: any;
|
|
128
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
129
|
+
[x: string]: any;
|
|
130
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
131
|
+
export declare const NavigationControl3D: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
132
|
+
[key: string]: any;
|
|
133
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
134
|
+
[x: string]: any;
|
|
135
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
136
|
+
export declare const ScaleControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
139
|
+
[x: string]: any;
|
|
140
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
141
|
+
export declare const OverviewMapControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
144
|
+
[x: string]: any;
|
|
145
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
146
|
+
export declare const MapTypeControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
147
|
+
[key: string]: any;
|
|
148
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
149
|
+
[x: string]: any;
|
|
150
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
151
|
+
export declare const CopyrightControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
154
|
+
[x: string]: any;
|
|
155
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
156
|
+
export declare const GeolocationControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
159
|
+
[x: string]: any;
|
|
160
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
161
|
+
export declare const PanoramaControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
162
|
+
[key: string]: any;
|
|
163
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
164
|
+
[x: string]: any;
|
|
165
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
166
|
+
export declare const ZoomControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
169
|
+
[x: string]: any;
|
|
170
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
171
|
+
export declare const CityListControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
172
|
+
[key: string]: any;
|
|
173
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
174
|
+
[x: string]: any;
|
|
175
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
176
|
+
export declare const LocationControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
177
|
+
[key: string]: any;
|
|
178
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
179
|
+
[x: string]: any;
|
|
180
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
181
|
+
export declare const LogoControl: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
182
|
+
[key: string]: any;
|
|
183
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {} | {
|
|
184
|
+
[x: string]: any;
|
|
185
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
186
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Point } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface TileLayerOptions {
|
|
4
|
+
transparentPng?: boolean;
|
|
5
|
+
tileUrlTemplate?: string;
|
|
6
|
+
zIndex?: number;
|
|
7
|
+
copyright?: unknown;
|
|
8
|
+
boundary?: string | string[];
|
|
9
|
+
opacity?: number;
|
|
10
|
+
showRegion?: string;
|
|
11
|
+
retry?: boolean;
|
|
12
|
+
retryTime?: number;
|
|
13
|
+
cacheSize?: number;
|
|
14
|
+
tileLoadFunction?: (tile: HTMLImageElement, url: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface NormalLayerOptions {
|
|
17
|
+
visible?: boolean;
|
|
18
|
+
opacity?: number;
|
|
19
|
+
minZoom?: number;
|
|
20
|
+
maxZoom?: number;
|
|
21
|
+
zIndex?: number;
|
|
22
|
+
enablePicked?: boolean;
|
|
23
|
+
autoSelect?: boolean;
|
|
24
|
+
popEvent?: boolean;
|
|
25
|
+
isTop?: boolean;
|
|
26
|
+
isLowText?: boolean;
|
|
27
|
+
referCenter?: Point;
|
|
28
|
+
pickWidth?: number;
|
|
29
|
+
pickHeight?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface GeoJSONLayerOptions {
|
|
32
|
+
dataSource?: unknown;
|
|
33
|
+
reference?: string;
|
|
34
|
+
markerStyle?: unknown;
|
|
35
|
+
polylineStyle?: unknown;
|
|
36
|
+
polygonStyle?: unknown;
|
|
37
|
+
minZoom?: number;
|
|
38
|
+
maxZoom?: number;
|
|
39
|
+
level?: number;
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface DistrictLayerOptions {
|
|
43
|
+
name?: string;
|
|
44
|
+
adcode?: string;
|
|
45
|
+
kind?: number;
|
|
46
|
+
autoViewport?: boolean;
|
|
47
|
+
strokeColor?: string;
|
|
48
|
+
strokeWeight?: number;
|
|
49
|
+
strokeOpacity?: number;
|
|
50
|
+
fillColor?: string;
|
|
51
|
+
fillOpacity?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface CustomLayerOptions {
|
|
54
|
+
databoxId?: string;
|
|
55
|
+
geotableId?: string;
|
|
56
|
+
q?: string;
|
|
57
|
+
tags?: string;
|
|
58
|
+
filter?: string;
|
|
59
|
+
pointDensity?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface CanvasLayerOptions {
|
|
62
|
+
zIndex?: number;
|
|
63
|
+
paneName?: string;
|
|
64
|
+
update?: Function;
|
|
65
|
+
}
|
|
66
|
+
export interface TrafficLayerOptions {
|
|
67
|
+
predictDate?: unknown;
|
|
68
|
+
}
|
|
69
|
+
export type TileLayerProps = TileLayerOptions;
|
|
70
|
+
export type NormalLayerProps = NormalLayerOptions;
|
|
71
|
+
export type GeoJSONLayerProps = GeoJSONLayerOptions;
|
|
72
|
+
export type DistrictLayerProps = DistrictLayerOptions;
|
|
73
|
+
export type CustomLayerProps = CustomLayerOptions;
|
|
74
|
+
export type CanvasLayerProps = CanvasLayerOptions;
|
|
75
|
+
export type TrafficLayerProps = TrafficLayerOptions;
|
|
76
|
+
export declare const TileLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
export declare const NormalLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
82
|
+
export declare const GeoJSONLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
85
|
+
export declare const DistrictLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
88
|
+
export declare const CustomLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
91
|
+
export declare const CanvasLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
94
|
+
export declare const TrafficLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
97
|
+
export interface RasterTileLayerOptions {
|
|
98
|
+
url: string | ((x: number, y: number, z: number) => string);
|
|
99
|
+
[k: string]: unknown;
|
|
100
|
+
}
|
|
101
|
+
export interface WMSLayerOptions {
|
|
102
|
+
url?: string;
|
|
103
|
+
params?: Record<string, string>;
|
|
104
|
+
[k: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
export interface WMTSLayerOptions {
|
|
107
|
+
url?: string;
|
|
108
|
+
params?: Record<string, string>;
|
|
109
|
+
[k: string]: unknown;
|
|
110
|
+
}
|
|
111
|
+
export interface XYZLayerOptions {
|
|
112
|
+
tileUrlTemplate?: string;
|
|
113
|
+
[k: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
export interface MVTLayerOptions {
|
|
116
|
+
tileUrlTemplate?: string;
|
|
117
|
+
[k: string]: unknown;
|
|
118
|
+
}
|
|
119
|
+
export type RasterTileLayerProps = RasterTileLayerOptions;
|
|
120
|
+
export type WMSLayerProps = WMSLayerOptions;
|
|
121
|
+
export type WMTSLayerProps = WMTSLayerOptions;
|
|
122
|
+
export type XYZLayerProps = XYZLayerOptions;
|
|
123
|
+
export type MVTLayerProps = MVTLayerOptions;
|
|
124
|
+
export declare const RasterTileLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
125
|
+
[key: string]: any;
|
|
126
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
127
|
+
export declare const WMSLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
128
|
+
[key: string]: any;
|
|
129
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
130
|
+
export declare const WMTSLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
131
|
+
[key: string]: any;
|
|
132
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
133
|
+
export declare const XYZLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
136
|
+
export declare const MVTLayer: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|