gdmap-utils 1.1.2 → 1.1.4
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/examples/3_MarkerLayer.html +275 -263
- package/examples/4_LabelMarkerLayer.html +266 -265
- package/package.json +6 -6
- package/src/layers/baseMarkerLayer/MarkerLayer.ts +1 -0
- package/src/layers/baseMarkerLayer/index.ts +50 -75
- package/webpack.config.js +55 -11
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
<button id="destroyBtn">销毁图层</button>
|
|
76
76
|
</div>
|
|
77
77
|
<!-- 加载地图JSAPI脚本 -->
|
|
78
|
-
<script src="../dist/index.js"></script>
|
|
78
|
+
<!-- <script src="../dist/index.js"></script> -->
|
|
79
79
|
<script>
|
|
80
80
|
const data = [
|
|
81
81
|
{
|
|
@@ -284,290 +284,291 @@
|
|
|
284
284
|
},
|
|
285
285
|
];
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
window.onload = () => {
|
|
288
|
+
const { createMapUtils } = MapUtils;
|
|
288
289
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
const loaderOpts = {
|
|
291
|
+
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
292
|
+
plugins: ['AMap.MapType', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
293
|
+
key: '9506c73ed67acb0a09f1aabf88df4819',
|
|
294
|
+
};
|
|
294
295
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
296
|
+
test();
|
|
297
|
+
|
|
298
|
+
async function test() {
|
|
299
|
+
const mapUtils = await createMapUtils(
|
|
300
|
+
{
|
|
301
|
+
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D'
|
|
302
|
+
zoom: 11, // 初始化地图层级
|
|
303
|
+
center: [data[0].jd, data[1].wd], // 初始化地图中心点
|
|
304
|
+
mountSelector: 'container',
|
|
305
|
+
},
|
|
306
|
+
loaderOpts
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
window.cleanPointLayer = mapUtils.createBaseMarkerLayer({
|
|
310
|
+
layerType: 'labelMarkerLayer',
|
|
311
|
+
layerName: 'cleanLabelMarkerPointLayer',
|
|
312
|
+
getIconUrl(item) {
|
|
313
|
+
if (window.flag) {
|
|
314
|
+
return '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-1.png';
|
|
315
|
+
}
|
|
316
|
+
return '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png';
|
|
317
|
+
},
|
|
318
|
+
getOverlayOpts(item, index, MapUtils) {
|
|
319
|
+
return {
|
|
320
|
+
name: item.name,
|
|
321
|
+
text: {
|
|
322
|
+
direction: 'top',
|
|
323
|
+
content: item.overlayData.title,
|
|
324
|
+
style: {
|
|
325
|
+
fontSize: 18,
|
|
326
|
+
fillColor: '#fff',
|
|
327
|
+
strokeColor: '#37e9bd',
|
|
328
|
+
strokeWidth: 5,
|
|
329
|
+
},
|
|
330
|
+
zooms: [1, 20],
|
|
330
331
|
},
|
|
331
|
-
|
|
332
|
-
},
|
|
333
|
-
/* label: {
|
|
332
|
+
/* label: {
|
|
334
333
|
content: `<div class="labelTitle">${item.overlayData.title}</div>`,
|
|
335
334
|
offset: MapUtils.Pixel(0, -5),
|
|
336
335
|
direction: 'top',
|
|
337
336
|
}, */
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
overlayList: data.slice(0, 10).map(item => {
|
|
340
|
+
return {
|
|
341
|
+
overlayData: {
|
|
342
|
+
lon: item.jd,
|
|
343
|
+
lat: item.wd,
|
|
344
|
+
title: item.sydmc,
|
|
345
|
+
id: item.id,
|
|
346
|
+
extData: item,
|
|
347
|
+
},
|
|
346
348
|
id: item.id,
|
|
347
|
-
|
|
349
|
+
labelShowed: true,
|
|
350
|
+
};
|
|
351
|
+
}),
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
cleanPointLayer.bindEventOverlays('click', () => {
|
|
355
|
+
console.log('哈哈哈哈');
|
|
356
|
+
});
|
|
357
|
+
// 图层适配
|
|
358
|
+
cleanPointLayer.overlayFitMap();
|
|
359
|
+
|
|
360
|
+
// 为add和remove方法添加测试代码
|
|
361
|
+
const addBtn = document.getElementById('addBtn');
|
|
362
|
+
const removeBtn = document.getElementById('removeBtn');
|
|
363
|
+
const removeByIdBtn = document.getElementById('removeByIdBtn');
|
|
364
|
+
|
|
365
|
+
// 添加新标记的计数器
|
|
366
|
+
let newMarkerId = 10000;
|
|
367
|
+
|
|
368
|
+
// 点击添加标记按钮
|
|
369
|
+
addBtn.addEventListener('click', () => {
|
|
370
|
+
// 创建一个新的标记数据
|
|
371
|
+
const newMarker = {
|
|
372
|
+
overlayData: {
|
|
373
|
+
lon: 121.515844 + Math.random() * 0.02 - 0.01, // 在中心点附近随机生成经度
|
|
374
|
+
lat: 31.218427 + Math.random() * 0.02 - 0.01, // 在中心点附近随机生成纬度
|
|
375
|
+
title: `新标记${newMarkerId}`,
|
|
376
|
+
id: newMarkerId,
|
|
377
|
+
extData: { id: newMarkerId, sydmc: `新标记${newMarkerId}` },
|
|
348
378
|
},
|
|
349
|
-
id:
|
|
379
|
+
id: newMarkerId,
|
|
350
380
|
labelShowed: true,
|
|
351
381
|
};
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
lat: 31.218427 + Math.random() * 0.02 - 0.01, // 在中心点附近随机生成纬度
|
|
376
|
-
title: `新标记${newMarkerId}`,
|
|
377
|
-
id: newMarkerId,
|
|
378
|
-
extData: { id: newMarkerId, sydmc: `新标记${newMarkerId}` },
|
|
379
|
-
},
|
|
380
|
-
id: newMarkerId,
|
|
381
|
-
labelShowed: true,
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
// 调用add方法添加标记
|
|
385
|
-
cleanPointLayer.add([newMarker]);
|
|
386
|
-
|
|
387
|
-
console.log(`添加了新标记: ${newMarkerId}`);
|
|
388
|
-
newMarkerId++;
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// 点击删除标记按钮
|
|
392
|
-
removeBtn.addEventListener('click', () => {
|
|
393
|
-
// 获取所有标记的ID
|
|
394
|
-
const markerIds = cleanPointLayer.getAllOverlay();
|
|
395
|
-
|
|
396
|
-
if (markerIds.length > 0) {
|
|
397
|
-
// 随机选择一个标记ID
|
|
398
|
-
const randomId = markerIds.pop();
|
|
399
|
-
|
|
400
|
-
// 调用remove方法删除标记
|
|
401
|
-
cleanPointLayer.remove([randomId]);
|
|
402
|
-
|
|
403
|
-
console.log(`删除了标记`, randomId);
|
|
404
|
-
} else {
|
|
405
|
-
console.log('没有可删除的标记');
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// 点击按ID删除按钮
|
|
410
|
-
removeByIdBtn.addEventListener('click', () => {
|
|
411
|
-
// 输入要删除的标记ID
|
|
412
|
-
const markerId = prompt('请输入要删除的标记ID:');
|
|
413
|
-
|
|
414
|
-
if (markerId) {
|
|
415
|
-
try {
|
|
416
|
-
const id = parseInt(markerId);
|
|
417
|
-
|
|
418
|
-
// 调用remove方法按ID删除标记
|
|
419
|
-
cleanPointLayer.remove([id]);
|
|
420
|
-
|
|
421
|
-
console.log(`删除了标记: ${id}`);
|
|
422
|
-
} catch (error) {
|
|
423
|
-
console.error('无效的标记ID');
|
|
382
|
+
|
|
383
|
+
// 调用add方法添加标记
|
|
384
|
+
cleanPointLayer.add([newMarker]);
|
|
385
|
+
|
|
386
|
+
console.log(`添加了新标记: ${newMarkerId}`);
|
|
387
|
+
newMarkerId++;
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// 点击删除标记按钮
|
|
391
|
+
removeBtn.addEventListener('click', () => {
|
|
392
|
+
// 获取所有标记的ID
|
|
393
|
+
const markerIds = cleanPointLayer.getAllOverlay();
|
|
394
|
+
|
|
395
|
+
if (markerIds.length > 0) {
|
|
396
|
+
// 随机选择一个标记ID
|
|
397
|
+
const randomId = markerIds.pop();
|
|
398
|
+
|
|
399
|
+
// 调用remove方法删除标记
|
|
400
|
+
cleanPointLayer.remove([randomId]);
|
|
401
|
+
|
|
402
|
+
console.log(`删除了标记`, randomId);
|
|
403
|
+
} else {
|
|
404
|
+
console.log('没有可删除的标记');
|
|
424
405
|
}
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
// 点击切换标签显示按钮
|
|
429
|
-
const toggleLabelBtn = document.getElementById('toggleLabelBtn');
|
|
430
|
-
const markerIdInput = document.getElementById('markerIdInput');
|
|
431
|
-
const refreshIconBtn = document.getElementById('refreshIconBtn');
|
|
432
|
-
|
|
433
|
-
toggleLabelBtn.addEventListener('click', () => {
|
|
434
|
-
const markerId = markerIdInput.value;
|
|
435
|
-
|
|
436
|
-
if (markerId) {
|
|
437
|
-
try {
|
|
438
|
-
const id = parseInt(markerId);
|
|
439
|
-
|
|
440
|
-
// 查找该标记当前的标签显示状态
|
|
441
|
-
const overlayIndex = cleanPointLayer.overlayList.findIndex(
|
|
442
|
-
item => item.id === id
|
|
443
|
-
);
|
|
444
|
-
|
|
445
|
-
if (overlayIndex !== -1) {
|
|
446
|
-
// 获取当前标签显示状态并取反
|
|
447
|
-
const currentLabelShow =
|
|
448
|
-
cleanPointLayer.overlayList[overlayIndex].labelShowed;
|
|
449
|
-
const newLabelShow = !currentLabelShow;
|
|
406
|
+
});
|
|
450
407
|
|
|
451
|
-
|
|
452
|
-
|
|
408
|
+
// 点击按ID删除按钮
|
|
409
|
+
removeByIdBtn.addEventListener('click', () => {
|
|
410
|
+
// 输入要删除的标记ID
|
|
411
|
+
const markerId = prompt('请输入要删除的标记ID:');
|
|
453
412
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
);
|
|
457
|
-
|
|
458
|
-
|
|
413
|
+
if (markerId) {
|
|
414
|
+
try {
|
|
415
|
+
const id = parseInt(markerId);
|
|
416
|
+
|
|
417
|
+
// 调用remove方法按ID删除标记
|
|
418
|
+
cleanPointLayer.remove([id]);
|
|
419
|
+
|
|
420
|
+
console.log(`删除了标记: ${id}`);
|
|
421
|
+
} catch (error) {
|
|
422
|
+
console.error('无效的标记ID');
|
|
459
423
|
}
|
|
460
|
-
} catch (error) {
|
|
461
|
-
console.error('无效的标记ID');
|
|
462
424
|
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// 点击切换标签显示按钮
|
|
428
|
+
const toggleLabelBtn = document.getElementById('toggleLabelBtn');
|
|
429
|
+
const markerIdInput = document.getElementById('markerIdInput');
|
|
430
|
+
const refreshIconBtn = document.getElementById('refreshIconBtn');
|
|
431
|
+
|
|
432
|
+
toggleLabelBtn.addEventListener('click', () => {
|
|
433
|
+
const markerId = markerIdInput.value;
|
|
434
|
+
|
|
435
|
+
if (markerId) {
|
|
436
|
+
try {
|
|
437
|
+
const id = parseInt(markerId);
|
|
438
|
+
|
|
439
|
+
// 查找该标记当前的标签显示状态
|
|
440
|
+
const overlayIndex = cleanPointLayer.overlayList.findIndex(
|
|
441
|
+
item => item.id === id
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
if (overlayIndex !== -1) {
|
|
445
|
+
// 获取当前标签显示状态并取反
|
|
446
|
+
const currentLabelShow =
|
|
447
|
+
cleanPointLayer.overlayList[overlayIndex].labelShowed;
|
|
448
|
+
|
|
449
|
+
cleanPointLayer.overlayList[overlayIndex].labelShowed = !currentLabelShow;
|
|
450
|
+
|
|
451
|
+
// 调用refreshOverlayLabel方法切换标签显示状态
|
|
452
|
+
cleanPointLayer.refreshOverlayLabel(id);
|
|
453
|
+
|
|
454
|
+
console.log(
|
|
455
|
+
`标记 ${id} 的标签显示状态已切换为: ${cleanPointLayer.overlayList[overlayIndex].labelShowed ? '显示' : '隐藏'}`
|
|
456
|
+
);
|
|
457
|
+
} else {
|
|
458
|
+
console.error('未找到指定ID的标记');
|
|
459
|
+
}
|
|
460
|
+
} catch (error) {
|
|
461
|
+
console.error('无效的标记ID',error);
|
|
491
462
|
}
|
|
492
|
-
}
|
|
493
|
-
console.error('
|
|
463
|
+
} else {
|
|
464
|
+
console.error('请输入标记ID');
|
|
494
465
|
}
|
|
495
|
-
}
|
|
496
|
-
console.error('请输入标记ID');
|
|
497
|
-
}
|
|
498
|
-
});
|
|
466
|
+
});
|
|
499
467
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
468
|
+
// 点击刷新图标按钮
|
|
469
|
+
refreshIconBtn.addEventListener('click', () => {
|
|
470
|
+
const markerId = markerIdInput.value;
|
|
503
471
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
console.log(
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
472
|
+
if (markerId) {
|
|
473
|
+
try {
|
|
474
|
+
const id = parseInt(markerId);
|
|
475
|
+
|
|
476
|
+
// 查找该标记
|
|
477
|
+
const overlayIndex = cleanPointLayer.overlayList.findIndex(
|
|
478
|
+
item => item.id === id
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
if (overlayIndex !== -1) {
|
|
482
|
+
// 切换窗口标记,用于改变图标
|
|
483
|
+
window.flag = !window.flag;
|
|
484
|
+
|
|
485
|
+
// 调用refreshOverlayIcon方法刷新图标
|
|
486
|
+
cleanPointLayer.refreshOverlayIcon(id);
|
|
487
|
+
|
|
488
|
+
console.log(`标记 ${id} 的图标已刷新`);
|
|
489
|
+
} else {
|
|
490
|
+
console.error('未找到指定ID的标记');
|
|
491
|
+
}
|
|
492
|
+
} catch (error) {
|
|
493
|
+
console.error('无效的标记ID');
|
|
494
|
+
}
|
|
495
|
+
} else {
|
|
496
|
+
console.error('请输入标记ID');
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// 点击自适应视图按钮
|
|
501
|
+
const fitViewBtn = document.getElementById('fitViewBtn');
|
|
502
|
+
const zoomOutBtn = document.getElementById('zoomOutBtn');
|
|
503
|
+
|
|
504
|
+
fitViewBtn.addEventListener('click', () => {
|
|
505
|
+
// 调用overlayFitMap方法,使地图自适应显示所有标记
|
|
506
|
+
cleanPointLayer.overlayFitMap();
|
|
507
|
+
console.log('已调用overlayFitMap方法,地图已自适应显示所有标记');
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// 点击缩小视图按钮
|
|
511
|
+
zoomOutBtn.addEventListener('click', () => {
|
|
512
|
+
// 先缩小地图视图
|
|
513
|
+
const currentZoom = mapUtils.map.getZoom();
|
|
514
|
+
mapUtils.map.setZoom(currentZoom - 2);
|
|
515
|
+
console.log('地图已缩小,当前缩放级别:', mapUtils.map.getZoom());
|
|
516
|
+
|
|
517
|
+
// 提示用户可以点击"自适应视图"按钮来测试效果
|
|
518
|
+
console.log(
|
|
519
|
+
'现在可以点击"自适应视图"按钮,测试overlayFitMap方法的效果'
|
|
520
|
+
);
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// 点击显示图层按钮
|
|
524
|
+
const showBtn = document.getElementById('showBtn');
|
|
525
|
+
showBtn.addEventListener('click', () => {
|
|
526
|
+
cleanPointLayer.show();
|
|
527
|
+
console.log('已调用show方法,图层已显示');
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
// 点击隐藏图层按钮
|
|
531
|
+
const hideBtn = document.getElementById('hideBtn');
|
|
532
|
+
hideBtn.addEventListener('click', () => {
|
|
533
|
+
cleanPointLayer.hide();
|
|
534
|
+
console.log('已调用hide方法,图层已隐藏');
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// 点击获取所有标记按钮
|
|
538
|
+
const getAllBtn = document.getElementById('getAllBtn');
|
|
539
|
+
getAllBtn.addEventListener('click', () => {
|
|
540
|
+
const allOverlays = cleanPointLayer.getAllOverlay();
|
|
541
|
+
console.log('已调用getAllOverlay方法,所有标记:', allOverlays);
|
|
542
|
+
alert(`当前共有 ${allOverlays.length} 个标记`);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
// 点击清空所有标记按钮
|
|
546
|
+
const clearAllBtn = document.getElementById('clearAllBtn');
|
|
547
|
+
clearAllBtn.addEventListener('click', () => {
|
|
548
|
+
if (confirm('确定要清空所有标记吗?')) {
|
|
549
|
+
cleanPointLayer.clearAllOverlay();
|
|
550
|
+
console.log('已调用clearAllOverlay方法,所有标记已清空');
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
// 点击重新加载图层按钮
|
|
555
|
+
const reloadBtn = document.getElementById('reloadBtn');
|
|
556
|
+
reloadBtn.addEventListener('click', () => {
|
|
557
|
+
window.flag = !window.flag;
|
|
558
|
+
cleanPointLayer.reload();
|
|
559
|
+
console.log('已调用reload方法,图层已重新加载');
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// 点击销毁图层按钮
|
|
563
|
+
const destroyBtn = document.getElementById('destroyBtn');
|
|
564
|
+
destroyBtn.addEventListener('click', () => {
|
|
565
|
+
if (confirm('确定要销毁图层吗?销毁后将无法恢复')) {
|
|
566
|
+
cleanPointLayer.destroy();
|
|
567
|
+
console.log('已调用destroy方法,图层已销毁');
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
};
|
|
571
572
|
</script>
|
|
572
573
|
</body>
|
|
573
574
|
</html>
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdmap-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "高德地图工具库",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "webpack --mode production",
|
|
9
|
-
"dev": "webpack --mode development
|
|
9
|
+
"dev": "webpack serve --mode development",
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
11
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
12
12
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
@@ -23,11 +23,10 @@
|
|
|
23
23
|
"@amap/amap-jsapi-loader": "^1.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
|
|
27
26
|
"@amap/amap-jsapi-types": "^0.0.15",
|
|
28
27
|
"@types/node": "^24.10.1",
|
|
29
28
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
30
|
-
"html-webpack-plugin": "^5.6.
|
|
29
|
+
"html-webpack-plugin": "^5.6.6",
|
|
31
30
|
"husky": "^9.1.7",
|
|
32
31
|
"lint-staged": "^16.2.7",
|
|
33
32
|
"prettier": "^3.7.4",
|
|
@@ -35,11 +34,12 @@
|
|
|
35
34
|
"type-fest": "^5.3.1",
|
|
36
35
|
"typescript": "^5.9.3",
|
|
37
36
|
"webpack": "^5.103.0",
|
|
38
|
-
"webpack-cli": "^6.0.1"
|
|
37
|
+
"webpack-cli": "^6.0.1",
|
|
38
|
+
"webpack-dev-server": "^5.2.3"
|
|
39
39
|
},
|
|
40
40
|
"lint-staged": {
|
|
41
41
|
"src/**/*.{ts,tsx,js,jsx,json,css,md}": [
|
|
42
42
|
"prettier --write"
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|