Location
容器属性
所有组件配置的第一层均支持容器属性
组件属性 componentsProps
| Name | Type | Default | 是否支持 Variable Pattern | Description |
|---|---|---|---|---|
| className | string | ✔️ | 组件的 className | |
| buttonText | string | 获取定位按钮的文字,不配置则使用默认国际化文案 | ||
| enableHighAccuracy | bool | true | 是否使用高精度定位 | |
| timeout | number | 10000 | 定位超时时间(毫秒) | |
| maximumAge | number | 0 | 缓存最大有效时间(毫秒),0 表示不缓存 | |
| reverseGeocodeUrl | string | 逆地理编码接口地址。定位成功后会 POST { latitude, longitude } 到此地址,期望返回 { address: "地址字符串" } 或直接返回地址字符串。不配置则仅展示经纬度坐标。 |
所有其余 componentsProps 将会被传给组件根元素(div)。
值格式
组件的 value 以 JSON 字符串形式存储,结构如下:
{
"latitude": 39.9042,
"longitude": 116.4074,
"address": "北京市东城区..."
}
其中 address 字段仅在配置了 reverseGeocodeUrl 并成功获取到地址时存在。
JS API
通过 formApi.getFieldApi() 获取的接口如下:
| Name | Type | Description |
|---|---|---|
| node | HTML Element | 组件的根 DOM 元素 |