import { Scene } from '@antv/l7'; import { CountryLayer } from '@antv/l7-district'; import { GaodeMap, Mapbox } from '@antv/l7-maps'; import * as React from 'react'; export default class Country extends React.Component { // @ts-ignore private scene: Scene; public componentWillUnmount() { this.scene.destroy(); } public async componentDidMount() { const scene = new Scene({ id: 'map', map: new Mapbox({ center: [116.2825, 39.9], pitch: 0, style: 'blank', zoom: 3, minZoom: 3, maxZoom: 10, }), }); scene.on('loaded', () => { const Layer = new CountryLayer(scene, { data: [], depth: 3, stroke: '#fff', coastlineWidth: 0.5, nationalWidth: 0.5, fill: { // scale: 'quantile', field: 'NAME', values: [ '#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603', ], }, popup: { Html: (props) => { return `${props.NAME}`; }, }, }); }); this.scene = scene; } public render() { return (
); } }