有一个标记数组,每个标记属于一个或多个类别。
您将如何实现搜索/过滤器来检索所有具有 cat = X 的标记?
例如:
- 所有带有 cat = 9 的标记?
- 所有带有 cat = 5 和 9 的标记?
Gmaps.map.markers = [
{"id":9,"cat":"3, 5, 6","lat":"52.50","lng":"13.32"},
{"id":11,"cat":"3","lat":"52.51","lng":"13.44"},
{"id":12,"cat":"1, 2, 5","lat":"47.89","lng":"10.62"},
{"id":13,"cat":"1, 2, 3, 4, 5","lat":"47.77","lng":"10.61"},
{"id":15,"cat":"1, 6","lat":"40.60","lng":"-73.44"},
{"id":16,"cat":"1, 3, 5, 9","lat":"51.89","lng":"17.16"},
{"id":17,"cat":"9","lat":"52.37","lng":"9.73"}
];