如何使用 AMap.DistrictLayer.Country 显示国建简易行政区图层 ?
代码如下:
<Map style={{ height: "calc(100% - 30px)" }} center={center} zoom={zoom} zoomEnable={false} dragEnable={false} keyboardEnable={false}>
{
({ AMap, map, container }) => {
console.log("UserAMapPage AMap => ", AMap);
console.log("UserAMapPage map => ", map);
console.log("UserAMapPage container => ", container);
console.log("UserAMapPage AMap.DistrictLayer => ", AMap.DistrictLayer);
console.log("UserAMapPage AMap.DistrictLayer.Country => ", AMap.DistrictLayer.Country);
return (
<AMap.DistrictLayer.Country
SOC={'CHN'}
depth={2}
adcode={100000}
zIndex={10}
styles={{
'nation-stroke': '#f09', 'coastline-stroke': [0.85, 0.63, 0.94, 1], 'province-stroke': 'white', 'city-stroke': 'rgba(255,255,255,0.15)',
'fill': (props) => {
console.log("UserAMapPage AMap.DistrictLayer.Country fill props => ", props);
return getColorByDGP(props.adcode_pro);
}
}}
/>);
}
}
总是报错,Uncaught TypeError: Cannot set properties of undefined (setting 'vI')