Skip to content

ttylikl/react-amap-plugin-autocomplete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

Autocomplete Plugin for react-amap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published