let data = {
features: [],
type: 'FeatureCollection'
}
area.forEach((item, index) => {
// console.log(item)
let color = ''
if (item.attrMap['业主方'] === '1111') {
color = 'blue'
} else if (item.attrMap['业主方'] === '2222') {
color = 'red'
} else if (item.attrMap['业主方'] === '3333') {
color = '#00ff8a'
} else if (item.attrMap['业主方'] === '4444') {
color = '#855CA4'
} else {
color = '#855'
}
data.features.push({
geometry: {
coordinates: [item.pointsArr],
type: 'Polygon'
},
properties: {
description: item.description ? item.description : '',
markerLatLng: item.pointsArr[0],
color:color
},
id: index,
type: 'Feature'
})
})
let layer = new PolygonLayer({
zIndex: 2
})
.source(data)
.color('color',(type)=>{
return type
})
.shape('fill')
.active(true)
.style({
opacity: 0.35
})
properties中绑定参数 , 在方法回调color 中指定参数名 可以获取到, 多个参数使用 * 拼接 'color * description'
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。