乐趣区

关于antv:关于antv-L7地图方法使用参数

  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’

退出移动版