0.0.4 • Published 6 years ago

react-amap-plugin-autocomplete v0.0.4

Weekly downloads
71
License
MIT
Repository
github
Last release
6 years ago

Autocomplete Plugin for react-amap

Usage:

npm install react-amap-plugin-autocomplete

Configurable props:

Visit AMap doc for details about ALL prop;

import { Map } from 'react-amap';
import Autocomplete from 'react-amap-plugin-autocomplete';

const pluginProps = {
  input: <input element id>   // optional
  ...
}

// inner input element style
const style = {
  ...
}

// on select item
selectfunc = (e) => { 
  if(e.poi.location) {
    this.setState({center:{longitude: e.poi.location.lng, latitude: e.poi.location.lat}})
  } 
}

// render
<Map>
   <Autocomplete options={pluginProps} onSelect={(e)=>this.selectfunc(e)} style={style} placeholder='搜索'/>
</Map>