Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps api 3 API 3.8:拖动标记后,如果marker.setMap(null),则它不会';别再出现了_Google Maps Api 3_Google Maps Markers - Fatal编程技术网

Google maps api 3 API 3.8:拖动标记后,如果marker.setMap(null),则它不会';别再出现了

Google maps api 3 API 3.8:拖动标记后,如果marker.setMap(null),则它不会';别再出现了,google-maps-api-3,google-maps-markers,Google Maps Api 3,Google Maps Markers,使用v3.8版,我通过拖动标记实现了这种行为 a) marker.setMap(map)-->map上的marker b) 拖动标记-->它是一个拖动的标记 c) marker.setMap(null)-->隐藏标记 d) marker.setMap(map)-->标记不显示 如果我强制使用v=3.7,一切正常,在d)中,标记出现在地图中 问候。在QAH的评论之后,这似乎是3.8版中的一个bug。查看并添加您的星号以帮助修复它 一种解决方法是使用marker.setVisible(false)或

使用v3.8版,我通过拖动标记实现了这种行为

a) marker.setMap(map)-->map上的marker

b) 拖动标记-->它是一个拖动的标记

c) marker.setMap(null)-->隐藏标记

d) marker.setMap(map)-->标记不显示

如果我强制使用v=3.7,一切正常,在d)中,标记出现在地图中


问候。

在QAH的评论之后,这似乎是3.8版中的一个bug。查看并添加您的星号以帮助修复它


一种解决方法是使用
marker.setVisible(false)
或您发现的早期版本。

但请注意:将null传递给setMap()只会将它们从映射中删除。如果你想实际删除覆盖,你必须设置一个空引用。谢谢你提供的信息。我将使用setVisible,它可以工作,并允许我使用v3.8来处理天气库。