移动端简单支持

This commit is contained in:
Shikong 2023-03-16 19:25:05 +08:00
parent 7496c9bb37
commit b12e066b7a

View File

@ -261,7 +261,7 @@ function search() {
// text, // text,
}) })
marker.on('mouseover', (e) => { function show(e) {
let position = e.data.data && e.data.data.position; let position = e.data.data && e.data.data.position;
if (position) { if (position) {
@ -284,11 +284,16 @@ function search() {
data.tmpMarker.setPosition(position); data.tmpMarker.setPosition(position);
map.add(data.tmpMarker); map.add(data.tmpMarker);
} }
}); }
marker.on('mouseout', () => { function hide() {
map.remove(data.tmpMarker); map.remove(data.tmpMarker);
}); }
marker.on('mouseover', (e)=>show(e));
marker.on('touchstart', (e)=>show(e));
marker.on('mouseout', ()=>hide());
marker.on('touchend', ()=>hide());
return marker; return marker;
}) })