提交 2e553b48 编写于 作者: Anne_LXM's avatar Anne_LXM

更新map示例

上级 181de5fb
...@@ -383,22 +383,28 @@ ...@@ -383,22 +383,28 @@
}; };
const removeMarker = () => { const removeMarker = () => {
// #ifdef APP
mapContext.value?.removeMarkers({markerIds:[4]})
// #endif
// #ifdef WEB
const index = markers.value.findIndex((marker: Marker):boolean=>{ const index = markers.value.findIndex((marker: Marker):boolean=>{
return marker.id == 4 return marker.id == 4
}); });
if (index != -1) { if (index != -1) {
mapContext.value?.removeMarkers({markerIds:[4]}) delete markers.value[index].label;
markers.value.splice(index, 1);
} else { } else {
uni.showToast({ uni.showToast({
title: '未找到该标记点', title: '未找到该标记点',
icon: 'none' icon: 'none'
}); });
} }
// #endif
}; };
// #ifdef WEB // #ifdef WEB
const addMarkersLabel = () => { const addMarkersLabel = () => {
markers.forEach((marker, index) => { markers.value.forEach((marker, index) => {
marker.label = { marker.label = {
content: 'Hello Label' + (index + 1), content: 'Hello Label' + (index + 1),
color: '#aa00ff', color: '#aa00ff',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册