Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afeiship/react-ant-geo-input
Geo input for react.
https://github.com/afeiship/react-ant-geo-input
ant antd geo input lat latitude lbs lng react
Last synced: about 2 months ago
JSON representation
Geo input for react.
- Host: GitHub
- URL: https://github.com/afeiship/react-ant-geo-input
- Owner: afeiship
- License: mit
- Created: 2021-05-06T08:38:08.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-07-10T11:07:46.000Z (over 3 years ago)
- Last Synced: 2024-10-28T07:30:15.035Z (3 months ago)
- Topics: ant, antd, geo, input, lat, latitude, lbs, lng, react
- Language: JavaScript
- Homepage:
- Size: 572 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# react-ant-geo-input
> Geo input for react.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```shell
npm install -S @jswork/react-ant-geo-input
```## properties
| Name | Type | Required | Default | Description |
| --------- | ------ | -------- | ------------------------------------- | ----------------------------------------------------------------- |
| className | string | false | - | The extended className for component. |
| appKey | string | false | '5Q5BZ-5EVWJ-SN5F3-K6QBZ-B3FAO-RVBWM' | The map appKey from `https://apis.map.qq.com/`. |
| secretKey | string | false | 'SWvT26ypwq5Nwb5RvS8cLi6NSoH8HlJX' | SecretKey from `https://lbs.qq.com/dev/console/application/mine`. |
| value | string | false | - | The changed value. |
| lng | number | false | - | The longtitude of the address. |
| lat | number | false | - | The latitude of the address. |
| onChange | func | false | noop | The change handler. |
| onError | func | false | noop | The handler when has error caught. |
| readOnly | bool | false | false | If lat/lng should be editalbe. |## usage
1. import css
```scss
@import "~@jswork/react-ant-geo-input/dist/style.css";// or use sass
@import "~@jswork/react-ant-geo-input/dist/style.scss";// customize your styles:
$react-ant-geo-input-options: ()
```
2. import js
```js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactAntGeoInput from '@jswork/react-ant-geo-input';
import './assets/style.scss';class App extends React.Component {
state = {
value: '上海市浦东新区博云路2号浦软大厦5楼',
lat: 31.202328,
lng: 121.603882
};render() {
const { value, lat, lng } = this.state;
return (
{
this.setState(e.target.value);
console.log('e:', e.target.value);
}}
/>
);
}
}ReactDOM.render(, document.getElementById('app'));
```
3. set proxy
```nginx
proxy: {
'/ws/geocoder': 'https://apis.map.qq.com'
}
```
4. preview at: http://0.0.0.0:8080/## documentation
- https://afeiship.github.io/react-ant-geo-input/## license
Code released under [the MIT license](https://github.com/afeiship/react-ant-geo-input/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/react-ant-geo-input
[version-url]: https://npmjs.org/package/@jswork/react-ant-geo-input[license-image]: https://img.shields.io/npm/l/@jswork/react-ant-geo-input
[license-url]: https://github.com/afeiship/react-ant-geo-input/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-ant-geo-input
[size-url]: https://github.com/afeiship/react-ant-geo-input/blob/master/dist/react-ant-geo-input.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/react-ant-geo-input
[download-url]: https://www.npmjs.com/package/@jswork/react-ant-geo-input