-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MassMarkersDataOptions能否添加自定义键值对? #327
Comments
@indomitableXiaoNan 这个是根据官网定义的,不明白你什么意思 |
react-amap/packages/types/src/overlay.d.ts Lines 1321 to 1330 in 9c18576
|
我是说MassMarkers的DataOptions,MassMarkersDataOptions ,因为我想创建海量点的时候把一些自定义的数据绑定到点上,比如id以及name,这样在点击海量点的时候直接能获取到绑定的id和name,我看type文件中的定义类型只能绑定经纬度和一个style来指定样式; |
在Demo中这个文件 packages\types\src\overlay.d.ts 这样声明的 type MassMarkersDataOptions = Array<{ lnglat: LngLat, style: number }>; 可以是这样吗 type MassMarkersDataOptions = Array<{ lnglat: LngLat, style: number, [key: string]: any }> |
我看了官方文档,如图: react-amap/packages/types/src/overlay.d.ts Line 1310 in 9c18576
你可以将你的数据通过下面方法实现 const data = [] as MassMarkersDataOptions @indomitableXiaoNan 正常按照官方文档来定义类型 |
好的,谢谢回复 |
目前看到的是type MassMarkersDataOptions = Array<{ lnglat: LngLat, style: number }>;,希望在使用MassMarkersData里面添加一些与lnglat同级的自定义字段,如何实现?
The text was updated successfully, but these errors were encountered: