Skip to main content

Location

Container Properties

The first layer of all component configurations supports Container Properties.

Component Properties (componentsProps)

NameTypeDefault是否支持 Variable PatternDescription
classNamestring✔️The className of the component.
buttonTextstringText for the locate button. Uses the default i18n text if not specified.
enableHighAccuracybooltrueWhether to use high-accuracy positioning.
timeoutnumber10000Positioning timeout in milliseconds.
maximumAgenumber0Maximum cache age in milliseconds. 0 means no caching.
reverseGeocodeUrlstringReverse geocoding API URL. After successful positioning, a POST request with { latitude, longitude } will be sent to this URL. Expected response: { address: "address string" } or a plain address string. If not configured, only coordinates are displayed.

All other componentsProps will be passed to the component's root element (div).

Value Format

The component value is stored as a JSON string with the following structure:

{
"latitude": 39.9042,
"longitude": 116.4074,
"address": "Some address..."
}

The address field is only present when reverseGeocodeUrl is configured and the address is successfully retrieved.

JS API

The interface obtained through formApi.getFieldApi() is as follows:

NameTypeDescription
nodeHTML ElementThe root DOM element of the component.