Code Monkey home page Code Monkey logo

Comments (8)

zuiidea avatar zuiidea commented on August 21, 2024 1

useCluster 使用 MarkerClustererOptions,renderClusterMarker 属性无效,可以参考这个在线例子

https://codesandbox.io/s/gaode-q6j8c

from react-amap.

ioslh avatar ioslh commented on August 21, 2024

你好,react-amap 的 Markers 组件已经可以配置使用 AMap.MarkerClusterer 插件了 ,参考useCluster 属性的使用
另外能否简要描述一下你想使用 AMap.MarkerClusterer 实现的需求,我收集一下需求好做进一步开发。

获取高德的 AMap 对象直接 window.AMap 就可以了。

from react-amap.

Wphilipp avatar Wphilipp commented on August 21, 2024

通过useCluseter好像只能使用默认样式的Clusterer,我需要自定义样式,所以尝试如下写法,但是控制台提示没有该插件
const plugins = [ { name: 'MarkerClusterer', options: { map: this.mapInstance, markers: this.markerInstance, opts: { gridSize: 50, renderCluserMarker:this._renderCluserMarker } } } ]
场景需求是 在地图上展示各个地区物联网设备的运行状态,不同故障级别的设备对应用不同的颜色的mark表示,一个地区的clusterer颜色由该地区内故障级别最高的mark的颜色表示。

from react-amap.

ioslh avatar ioslh commented on August 21, 2024

useCluster 支持传入对象配置,参考这个示例 https://jsfiddle.net/y9cv20cv/10/ 的使用。

不过你提醒了我, Markers 组件的设计不够灵活,覆盖了 Clusterer 默认的点击行为。近期会稍微升级一下以插件形式提供。

from react-amap.

Wphilipp avatar Wphilipp commented on August 21, 2024

OK 谢谢大佬

from react-amap.

Wphilipp avatar Wphilipp commented on August 21, 2024

在问一下 如何获取这个mark对象?
https://jsfiddle.net/y9cv20cv/11/

from react-amap.

ioslh avatar ioslh commented on August 21, 2024

绑定 events.created 方法。参考 Markers 组件事件绑定 示例

from react-amap.

Wphilipp avatar Wphilipp commented on August 21, 2024

好的,谢谢

from react-amap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.