@cn-map/gaode-vue 0.0.0-stage → 0.0.1
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 +293 -2
- package/dist/context-BEyZOuBr.js +88 -0
- package/dist/index.d.ts +1931 -0
- package/dist/index.js +4717 -0
- package/dist/loca.d.ts +541 -0
- package/dist/loca.js +1288 -0
- package/package.json +84 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Jungzl.
|
|
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
CHANGED
|
@@ -1,3 +1,294 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cn-map/gaode-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
高德地图 Vue 组件库,基于高德地图 JavaScript API 2.0 开发。提供了一套 Vue 3 组件、组合式函数和工具,用于构建高德地图应用。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🎯 **类型友好** - 组件与 Hooks 提供类型定义
|
|
8
|
+
- 🚀 **Vue 3 兼容** - 支持最新的 Vue 3 特性
|
|
9
|
+
- 🎨 **丰富的组件** - 覆盖地图、覆盖物、图层、控件与常用工具
|
|
10
|
+
- 🧩 **可与原生 API 混用** - WebService 等未封装能力可直接调用原生 `AMap.*`
|
|
11
|
+
- 📊 **3D 可视化** - 基于 Loca 的可视化组件
|
|
12
|
+
- 🛠️ **易于使用** - 简洁的 API 设计
|
|
13
|
+
- 📦 **按需加载** - 支持组件按需导入
|
|
14
|
+
- 🔧 **组合式 API** - 提供组合式函数,便于逻辑复用
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @cn-map/gaode-vue
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @cn-map/gaode-vue
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add @cn-map/gaode-vue
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bun add @cn-map/gaode-vue
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
TypeScript 类型见 [`@cn-map/gaode-types`](../types/README.md)。
|
|
35
|
+
|
|
36
|
+
## 使用示例
|
|
37
|
+
|
|
38
|
+
### 基础地图
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { APILoader, LoadStatus, Map, Marker, useAPIStatus } from '@cn-map/gaode-vue'
|
|
43
|
+
|
|
44
|
+
const status = useAPIStatus('AMap')
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<APILoader api-key="YOUR_AMAP_KEY">
|
|
49
|
+
<Map v-if="status === LoadStatus.Loaded" :center="[116.397428, 39.90923]" style="height: 400px" :zoom="13">
|
|
50
|
+
<Marker :position="[116.397428, 39.90923]" />
|
|
51
|
+
</Map>
|
|
52
|
+
</APILoader>
|
|
53
|
+
</template>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
or
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { APILoader, LoadStatus, Map, Marker } from '@cn-map/gaode-vue'
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<APILoader api-key="YOUR_AMAP_KEY">
|
|
65
|
+
<template #default="{ status }">
|
|
66
|
+
<Map v-if="status.AMap === LoadStatus.Loaded" :center="[116.397428, 39.90923]" style="height: 400px" :zoom="13">
|
|
67
|
+
<Marker :position="[116.397428, 39.90923]" />
|
|
68
|
+
</Map>
|
|
69
|
+
</template>
|
|
70
|
+
</APILoader>
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 使用 Loca 可视化
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import { APILoader, LoadStatus, Map, useAPIStatus } from '@cn-map/gaode-vue'
|
|
79
|
+
import { GeoJSONSource, HeatMapLayer, Loca } from '@cn-map/gaode-vue/loca'
|
|
80
|
+
|
|
81
|
+
const status = useAPIStatus()
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<template>
|
|
85
|
+
<APILoader :Loca="{}" api-key="YOUR_AMAP_KEY">
|
|
86
|
+
<Map
|
|
87
|
+
v-if="status.AMap === LoadStatus.Loaded"
|
|
88
|
+
:center="[102.618687, 31.790976]"
|
|
89
|
+
map-style="amap://styles/whitesmoke"
|
|
90
|
+
:pitch="40"
|
|
91
|
+
style="height: 400px"
|
|
92
|
+
view-mode="3D"
|
|
93
|
+
:zoom="4"
|
|
94
|
+
:zooms="[4, 7]"
|
|
95
|
+
>
|
|
96
|
+
<Loca v-if="status.Loca === LoadStatus.Loaded">
|
|
97
|
+
<GeoJSONSource url="https://a.amap.com/Loca/static/loca-v2/demos/mock_data/traffic.json">
|
|
98
|
+
<HeatMapLayer
|
|
99
|
+
:opacity="1"
|
|
100
|
+
:style="{
|
|
101
|
+
gradient: {
|
|
102
|
+
0.1: '#2A85B8',
|
|
103
|
+
0.2: '#16B0A9',
|
|
104
|
+
0.3: '#29CF6F',
|
|
105
|
+
0.4: '#5CE182',
|
|
106
|
+
0.5: '#7DF675',
|
|
107
|
+
0.6: '#FFF100',
|
|
108
|
+
0.7: '#FAA53F',
|
|
109
|
+
1.0: '#D04343',
|
|
110
|
+
},
|
|
111
|
+
height: 500000,
|
|
112
|
+
heightBezier: [0, 0.53, 0.37, 0.98],
|
|
113
|
+
radius: 200000,
|
|
114
|
+
value(index, feature) {
|
|
115
|
+
const value = Number.parseFloat(feature.properties.mom)
|
|
116
|
+
return value + 10 * Math.random()
|
|
117
|
+
},
|
|
118
|
+
unit: 'meter',
|
|
119
|
+
}"
|
|
120
|
+
:visible="true"
|
|
121
|
+
:z-index="10"
|
|
122
|
+
/>
|
|
123
|
+
</GeoJSONSource>
|
|
124
|
+
</Loca>
|
|
125
|
+
</Map>
|
|
126
|
+
</APILoader>
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 核心组件
|
|
131
|
+
|
|
132
|
+
### API 加载器
|
|
133
|
+
|
|
134
|
+
| 导出名称 | 类型 | 描述 |
|
|
135
|
+
| ------------------ | ---------- | ------------------------------ |
|
|
136
|
+
| `APILoader` | 组件 | 高德地图 JavaScript API 加载器 |
|
|
137
|
+
| `APILoaderOptions` | 类型 | APILoader 组件的配置选项 |
|
|
138
|
+
| `LoadStatus` | 枚举 | 表示加载状态的枚举值 |
|
|
139
|
+
| `useAPIError` | 组合式函数 | 获取 API 加载错误信息 |
|
|
140
|
+
| `useAPILoader` | 组合式函数 | 加载高德地图 API |
|
|
141
|
+
| `useAPIStatus` | 组合式函数 | 检查 API 加载状态 |
|
|
142
|
+
|
|
143
|
+
### 地图组件
|
|
144
|
+
|
|
145
|
+
| 导出名称 | 类型 | 描述 |
|
|
146
|
+
| -------- | ---------- | ------------ |
|
|
147
|
+
| `Map` | 组件 | 地图容器组件 |
|
|
148
|
+
| `useMap` | 组合式函数 | 获取地图实例 |
|
|
149
|
+
|
|
150
|
+
### 地图控制组件
|
|
151
|
+
|
|
152
|
+
| 导出名称 | 类型 | 描述 |
|
|
153
|
+
| ------------- | ---- | ---------------- |
|
|
154
|
+
| `ControlBar` | 组件 | 组合控件 |
|
|
155
|
+
| `Geolocation` | 组件 | 定位控件 |
|
|
156
|
+
| `HawkEye` | 组件 | 鹰眼控件 |
|
|
157
|
+
| `MapType` | 组件 | 地图类型切换控件 |
|
|
158
|
+
| `Scale` | 组件 | 比例尺控件 |
|
|
159
|
+
| `ToolBar` | 组件 | 工具条控件 |
|
|
160
|
+
|
|
161
|
+
### 地图图层
|
|
162
|
+
|
|
163
|
+
| 导出名称 | 类型 | 描述 |
|
|
164
|
+
| ---------------------------- | ---- | ---------------- |
|
|
165
|
+
| `Buildings`, `BuildingLayer` | 组件 | 楼块图层 |
|
|
166
|
+
| `CanvasLayer` | 组件 | Canvas 图层 |
|
|
167
|
+
| `CustomLayer` | 组件 | 自定义图层 |
|
|
168
|
+
| `DistrictLayer` | 组件 | 行政区图层 |
|
|
169
|
+
| `Country` | 组件 | 国家图层 |
|
|
170
|
+
| `Province` | 组件 | 省份图层 |
|
|
171
|
+
| `World` | 组件 | 世界图层 |
|
|
172
|
+
| `Flexible` | 组件 | 灵活切片图层 |
|
|
173
|
+
| `GLCustomLayer` | 组件 | WebGL 自定义图层 |
|
|
174
|
+
| `HeatMap` | 组件 | 热力图图层 |
|
|
175
|
+
| `ImageLayer` | 组件 | 图片图层 |
|
|
176
|
+
| `IndoorMap` | 组件 | 室内地图图层 |
|
|
177
|
+
| `LabelsLayer` | 组件 | 标注图层 |
|
|
178
|
+
| `LayerGroup` | 组件 | 图层群组 |
|
|
179
|
+
| `Mapbox` | 组件 | Mapbox 图层 |
|
|
180
|
+
| `MapboxVectorTileLayer` | 组件 | MVT 图层 |
|
|
181
|
+
| `TileLayer` | 组件 | 切片图层 |
|
|
182
|
+
| `Flexible` | 组件 | 灵活切片图层 |
|
|
183
|
+
| `Mark` | 组件 | 白嫖标记图层 |
|
|
184
|
+
| `RoadNet` | 组件 | 路网图层 |
|
|
185
|
+
| `Satellite` | 组件 | 卫星图层 |
|
|
186
|
+
| `Traffic` | 组件 | 实时交通图层 |
|
|
187
|
+
| `WMS` | 组件 | WMS 图层 |
|
|
188
|
+
| `WMTS` | 组件 | WMTS 图层 |
|
|
189
|
+
| `VectorLayer` | 组件 | 矢量图层 |
|
|
190
|
+
|
|
191
|
+
### 覆盖物组件
|
|
192
|
+
|
|
193
|
+
| 导出名称 | 类型 | 描述 |
|
|
194
|
+
| --------------- | ---- | -------------- |
|
|
195
|
+
| `BezierCurve` | 组件 | 贝塞尔曲线 |
|
|
196
|
+
| `Circle` | 组件 | 圆形 |
|
|
197
|
+
| `CircleMarker` | 组件 | 圆点标记 |
|
|
198
|
+
| `ContextMenu` | 组件 | 右键菜单 |
|
|
199
|
+
| `ElasticMarker` | 组件 | 灵活点标记 |
|
|
200
|
+
| `Ellipse` | 组件 | 椭圆 |
|
|
201
|
+
| `IndexCluster` | 组件 | 索引点聚合 |
|
|
202
|
+
| `InfoWindow` | 组件 | 信息窗体 |
|
|
203
|
+
| `LabelMarker` | 组件 | 标注标记 |
|
|
204
|
+
| `Marker` | 组件 | 点标记 |
|
|
205
|
+
| `MarkerCluster` | 组件 | 点聚合 |
|
|
206
|
+
| `MassMarks` | 组件 | 海量点 |
|
|
207
|
+
| `OverlayGroup` | 组件 | 覆盖物群组 |
|
|
208
|
+
| `Polygon` | 组件 | 多边形 |
|
|
209
|
+
| `Polyline` | 组件 | 折线 |
|
|
210
|
+
| `Rectangle` | 组件 | 矩形 |
|
|
211
|
+
| `Text` | 组件 | 文本标记 |
|
|
212
|
+
| `VectorOverlay` | 组件 | 矢量图形覆盖物 |
|
|
213
|
+
|
|
214
|
+
### 工具组件
|
|
215
|
+
|
|
216
|
+
| 导出名称 | 类型 | 描述 |
|
|
217
|
+
| ------------------- | ---- | ---------------- |
|
|
218
|
+
| `BezierCurveEditor` | 组件 | 贝塞尔曲线编辑器 |
|
|
219
|
+
| `CircleEditor` | 组件 | 圆形编辑器 |
|
|
220
|
+
| `EllipseEditor` | 组件 | 椭圆编辑器 |
|
|
221
|
+
| `MouseTool` | 组件 | 鼠标工具 |
|
|
222
|
+
| `PolygonEditor` | 组件 | 多边形编辑器 |
|
|
223
|
+
| `PolylineEditor` | 组件 | 折线编辑器 |
|
|
224
|
+
| `RangingTool` | 组件 | 测距工具 |
|
|
225
|
+
| `RectangleEditor` | 组件 | 矩形编辑器 |
|
|
226
|
+
|
|
227
|
+
## Loca 可视化组件
|
|
228
|
+
|
|
229
|
+
基于 Loca 库的高级 3D 可视化组件,从 `@cn-map/gaode-vue/loca` 导入::
|
|
230
|
+
|
|
231
|
+
### Loca 容器
|
|
232
|
+
|
|
233
|
+
| 导出名称 | 类型 | 描述 |
|
|
234
|
+
| --------- | ---------- | -------------- |
|
|
235
|
+
| `Loca` | 组件 | Loca 容器组件 |
|
|
236
|
+
| `useLoca` | 组合式函数 | 访问 Loca 实例 |
|
|
237
|
+
|
|
238
|
+
### Loca 图层
|
|
239
|
+
|
|
240
|
+
| 导出名称 | 类型 | 描述 |
|
|
241
|
+
| ---------------- | ---- | ------------ |
|
|
242
|
+
| `GridLayer` | 组件 | 网格图层 |
|
|
243
|
+
| `HeatMapLayer` | 组件 | 热力图图层 |
|
|
244
|
+
| `HexagonLayer` | 组件 | 蜂窝图层 |
|
|
245
|
+
| `IconLayer` | 组件 | 图标图层 |
|
|
246
|
+
| `LabelsLayer` | 组件 | 标注图层 |
|
|
247
|
+
| `LaserLayer` | 组件 | 激光图层 |
|
|
248
|
+
| `LineLayer` | 组件 | 线图层 |
|
|
249
|
+
| `LinkLayer` | 组件 | 连接图层 |
|
|
250
|
+
| `PointLayer` | 组件 | 点图层 |
|
|
251
|
+
| `PolygonLayer` | 组件 | 面图层 |
|
|
252
|
+
| `PrismLayer` | 组件 | 棱柱图层 |
|
|
253
|
+
| `PulseLineLayer` | 组件 | 脉冲线图层 |
|
|
254
|
+
| `PulseLinkLayer` | 组件 | 脉冲连接图层 |
|
|
255
|
+
| `ScatterLayer` | 组件 | 散点图层 |
|
|
256
|
+
| `ZMarkerLayer` | 组件 | Z轴标记图层 |
|
|
257
|
+
|
|
258
|
+
### Loca 光照
|
|
259
|
+
|
|
260
|
+
| 导出名称 | 类型 | 描述 |
|
|
261
|
+
| ------------------ | ---- | ------ |
|
|
262
|
+
| `AmbientLight` | 组件 | 环境光 |
|
|
263
|
+
| `DirectionalLight` | 组件 | 平行光 |
|
|
264
|
+
| `PointLight` | 组件 | 点光源 |
|
|
265
|
+
|
|
266
|
+
### Loca UI 组件
|
|
267
|
+
|
|
268
|
+
| 导出名称 | 类型 | 描述 |
|
|
269
|
+
| -------- | ---- | -------- |
|
|
270
|
+
| `Legend` | 组件 | 图例组件 |
|
|
271
|
+
|
|
272
|
+
### Loca 数据源
|
|
273
|
+
|
|
274
|
+
| 导出名称 | 类型 | 描述 |
|
|
275
|
+
| ----------------- | ---- | ---------------- |
|
|
276
|
+
| `GeoBufferSource` | 组件 | GeoBuffer 数据源 |
|
|
277
|
+
| `GeoJSONSource` | 组件 | GeoJSON 数据源 |
|
|
278
|
+
|
|
279
|
+
## 组合式函数
|
|
280
|
+
|
|
281
|
+
### 实例相关
|
|
282
|
+
|
|
283
|
+
| 导出名称 | 描述 |
|
|
284
|
+
| ------------- | ---------------------------- |
|
|
285
|
+
| `useInstance` | 获取组件实例的通用组合式函数 |
|
|
286
|
+
|
|
287
|
+
## 相关链接
|
|
288
|
+
|
|
289
|
+
- [高德地图 JavaScript API 文档](https://lbs.amap.com/api/jsapi-v2/summary)
|
|
290
|
+
- [Loca 可视化文档](https://lbs.amap.com/api/loca-v2/intro)
|
|
291
|
+
|
|
292
|
+
## 许可证
|
|
293
|
+
|
|
294
|
+
[MIT](https://github.com/Jungzl/amap/blob/main/LICENSE)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { computed, inject, provide, shallowRef, toRaw, watchEffect } from "vue";
|
|
2
|
+
import { lostContextError, lowercase } from "@cn-map/gaode-shared/utils";
|
|
3
|
+
// src/composables/use-event-listeners.ts
|
|
4
|
+
var use_event_listeners_default = (target, emits, eventTypes = []) => {
|
|
5
|
+
watchEffect((onCleanup) => {
|
|
6
|
+
const cleanupFunctions = [];
|
|
7
|
+
for (const eventType of eventTypes) {
|
|
8
|
+
const handler = (e) => emits(eventType, e);
|
|
9
|
+
target.value?.on(lowercase(eventType), handler);
|
|
10
|
+
cleanupFunctions.push(() => {
|
|
11
|
+
target.value?.off(lowercase(eventType), handler);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
onCleanup(() => {
|
|
15
|
+
cleanupFunctions.forEach((cleanup) => cleanup());
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
// src/utils/helpers.ts
|
|
20
|
+
/**
|
|
21
|
+
* Creates a reactive proxy that omits specific keys from props.
|
|
22
|
+
* Preserves the original semantic type name layout instead of expanding it.
|
|
23
|
+
*/
|
|
24
|
+
function shallowReactiveOmit(props, ...keys) {
|
|
25
|
+
const flatKeys = new Set(keys.flat(Infinity));
|
|
26
|
+
return new Proxy(props, {
|
|
27
|
+
get(target, key, receiver) {
|
|
28
|
+
if (flatKeys.has(key)) return;
|
|
29
|
+
return Reflect.get(target, key, receiver);
|
|
30
|
+
},
|
|
31
|
+
has(target, key) {
|
|
32
|
+
if (flatKeys.has(key)) return false;
|
|
33
|
+
return Reflect.has(target, key);
|
|
34
|
+
},
|
|
35
|
+
ownKeys(target) {
|
|
36
|
+
return Reflect.ownKeys(target).filter((key) => !flatKeys.has(key));
|
|
37
|
+
},
|
|
38
|
+
getOwnPropertyDescriptor(target, key) {
|
|
39
|
+
if (flatKeys.has(key)) return;
|
|
40
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new object composed of the properties that are not undefined.
|
|
46
|
+
*
|
|
47
|
+
* Keys are enumerated via `Object.keys(props)` so proxy-based omit helpers like
|
|
48
|
+
* `shallowReactiveOmit` keep applying their key filtering, while values are read
|
|
49
|
+
* from the raw object (`toRaw`) to avoid triggering reactivity tracking.
|
|
50
|
+
*/
|
|
51
|
+
function toDefinedRaw(props) {
|
|
52
|
+
const result = {};
|
|
53
|
+
const obj = toRaw(props);
|
|
54
|
+
const keys = Object.keys(props);
|
|
55
|
+
for (let i = 0; i < keys.length; i++) {
|
|
56
|
+
const key = keys[i];
|
|
57
|
+
const value = obj[key];
|
|
58
|
+
if (value !== void 0) result[key] = toRaw(value);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
// src/map/context.ts
|
|
63
|
+
const AMap_Symbol_Map = Symbol("Map");
|
|
64
|
+
/**
|
|
65
|
+
* 设置地图实例Context
|
|
66
|
+
* @param {ShallowRef<Nullable<AMap.Map>>} map - 地图实例ref
|
|
67
|
+
*/
|
|
68
|
+
function setMapContext(map) {
|
|
69
|
+
provide(AMap_Symbol_Map, map);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 获取地图实例
|
|
73
|
+
* @returns {ShallowRef<Nullable<AMap.Map>>} - 地图实例ref
|
|
74
|
+
*/
|
|
75
|
+
function useMap() {
|
|
76
|
+
const context = inject(AMap_Symbol_Map);
|
|
77
|
+
if (!context) throw lostContextError("`AMap.Map`");
|
|
78
|
+
return context;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 获取地图实例
|
|
82
|
+
* @returns {ComputedRef<Nullable<AMap.Map>>} - 地图实例ref
|
|
83
|
+
*/
|
|
84
|
+
function useMapInstance(props) {
|
|
85
|
+
const map = inject(AMap_Symbol_Map, shallowRef(null));
|
|
86
|
+
return computed(() => props.map ?? map.value);
|
|
87
|
+
}
|
|
88
|
+
export { toDefinedRaw as a, shallowReactiveOmit as i, useMap as n, use_event_listeners_default as o, useMapInstance as r, setMapContext as t };
|