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

更新map示例

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