tdt-map-vue 1.0.7 → 1.0.9

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.
Files changed (2) hide show
  1. package/README.md +15 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -110,7 +110,7 @@ export default {
110
110
  - `hideMarkers(markers)`:隐藏标注
111
111
  - `getAllMarkers()`:获取全部标注
112
112
  - `setCenterAndZoom(center, zoom)`:设置地图中心点和缩放级别
113
- - `getMapLngLat()`:获取当前拾取到的坐标点
113
+ - `getPickupPoint()`:获取当前拾取到的坐标点
114
114
  - `destroyMap()`:销毁地图
115
115
  - `resizeMap()`:重新计算地图尺寸
116
116
 
@@ -201,16 +201,9 @@ const goToCity = () => {
201
201
  </script>
202
202
  ```
203
203
 
204
- #### 3 获取拾取坐标 `getMapLngLat()`
204
+ #### 3 获取拾取坐标 `getPickupPoint()`
205
205
 
206
- `getMapLngLat(callback)` ,传入要执行的回调时事件会传入刚刚拾取的坐标,不传入则直接返回坐标点数据
207
-
208
- ```js
209
- {
210
- lng: 117.017362,
211
- lat: 25.075884
212
- }
213
- ```
206
+ `getPickupPoint(callback)` ,传入要执行的回调时事件会传入刚刚拾取的坐标,不传入则直接返回坐标点数据
214
207
 
215
208
  ```vue
216
209
  <template>
@@ -227,12 +220,19 @@ import TiandiMap from "tdt-map-vue";
227
220
  const mapRef = ref(null);
228
221
 
229
222
  const getPickedPoint = () => {
230
- mapRef.value?.getMapLngLat(getFunc);//
231
- const getFunc = (lag) => {
232
- console.log("获取到了坐标====", lag);
223
+ mapRef.value?.getPickupPoint(getFunc); // 传入要执行的回调函数
224
+ };
225
+ // 回调函数的入参为获取到的坐标点对象
226
+ {
227
+ lng: 117.017362,
228
+ lat: 25.075884
229
+ }
230
+ //
231
+ const getFunc = (point) => {
232
+ console.log("获取到了坐标====", point);
233
233
  mapRef.value.addMarkers([
234
234
  {
235
- ...lag,
235
+ ...point,
236
236
  option: {
237
237
  content: "<div> 新增坐标点</div>",
238
238
  },
@@ -392,7 +392,7 @@ export default {
392
392
  - `tk` 必须替换成你自己的天地图 API Key
393
393
  - 如果需要在 Vue 2 项目中使用,请确保安装了 `vue-template-compiler` 且版本与 `vue` 保持一致
394
394
  - 如果你最近刚发布过新版本,但本地项目还是旧代码,请先删除缓存并重新安装依赖
395
- - 如果你要在父组件里拿到拾取坐标,可以通过 `ref` 调用 `getMapLngLat()`
395
+ - 如果你要在父组件里拿到拾取坐标,可以通过 `ref` 调用 `getPickupPoint()`
396
396
  - 如果你想拿到天地图拾取回调中的原始坐标对象,可以结合 `ready` 事件和组件实例方法做二次封装
397
397
 
398
398
  ## 常见问题
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tdt-map-vue",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "基于 Vue 2/3 的天地图二次封装组件,提供地图初始化、标注管理、地理编码搜索和常用实例方法调用能力。",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",