rc-poi-cenan
v1.0.0
Published
this is a react-redux project
Downloads
1
Readme
rc-poi
淘宝本地生活通用POI组件
使用方法
1. 安装
tnpm install @ali/rc-poi
2. 引用
- 完整引用(包含全部UI, 地址切换, POI弹出选择功能)
import React from 'react';
import ReactDom from 'react-dom';
import LocationComponet from '@ali/rc-poi';
ReactDom.render(<div className="wrapper">
<LocationComponet onAddressChange={console.log} />
</div>, document.getElementById("react-wrap"))
//props onAddressChange 为回调钩子, 在每次位置信息发生变化时都会出发(包括首次获取到位置信息)
- 仅引用poi工具类
import geoLocation from '@ali/rc-poi/js/common/geoLocation'
geoLocation.getGeoLocation(function(location){
console.log(location);
}, true);
//第一个参数为回调方法, 第二个参数为是否在未获取到地址时(比如用户关闭定位等情况)显示alert引导提示
location结构:
{
address: "阿里巴巴西溪园区",
addressName: "阿里巴巴西溪园区",
cityCode: "330110",
cityId: "330110",
cityName: "杭州市",
citycode: "330110",
cityid: "330110",
expirationTime: 1472612539971,
la: "30.279212",
latitude: "30.279212",
lo: "120.026208",
longitude: "120.026208"
}