Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
http://jsfiddle.net/michaelgruber/M84T7/
当 codeAddress 函数运行不止一次时(运行多个输入时),旧标记将保存在地图上。为什么是这样?不应该覆盖 MyMap.marker 吗?
不应该覆盖 MyMap.marker 吗?
是的,但它是对标记的引用,而不是标记本身。
要隐藏标记:
marker.setMap(null);
在覆盖它并丢失参考之前。
http://jsfiddle.net/zbZ8p/1/