UNPKG

react-amap-v2

Version:

高德地图 v2.0 react 组件

53 lines (45 loc) 1.06 kB
--- order: 6 --- # Ellipse ## 快速入门 此处给出了最简单示例 ```tsx import React, { useState } from 'react'; import { Map, Ellipse } from 'react-amap-v2'; import Paper from '@material-ui/core/Paper'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import Switch from '@material-ui/core/Switch'; export default () => { const [editable, setEditable] = useState(false); return ( <Map zoom={14} center={[116.433322, 39.900255]}> <Paper color="text.primary" style={{ zIndex: 10, position: 'absolute', top: 20, right: 20, padding: '0 10px', }} > <FormControlLabel control={ <Switch checked={editable} onChange={e => setEditable(e.target.checked)} /> } label="可编辑" /> </Paper> <Ellipse editable={editable} center={[116.433322, 39.900255]} radius={[2000, 1000]} /> </Map> ); }; ```