my.chooseLocation
Open the built-in map to choose a location.
Supported types of mini programs: DSL, H5+
Sample code
ACSS
/* API-DEMO page/API/choose-location/choose-location.acss */
.page-body-info {
height: 250rpx;
}
.page-body-text-location {
display: flex;
font-size: 50rpx;
}
.page-body-text-location text {
margin: 10rpx;
}
.page-section-location-text{
color: #49a9ee;
}JS
DSL
my.chooseLocation({
success: (res) => {
console.log('chooseLocation Success:', JSON.stringify(res, null, 2))
},
fail: (err) => {
console.log('chooseLocation Failed:', JSON.stringify(err, null, 2))
}
});H5+
AlipayJSBridge.call('beehiveGetPOI', {}, function (res) {
alert('AlipayJSBridge chooseLocation result:\n' + JSON.stringify(res));
});Parameters
Property | Type | Required | Description |
success | Function | No | The callback method that indicates a successful call. |
fail | Function | No | The callback method that indicates a failed call. |
complete | Function | No | The callback method that indicates the call is completed (this will be executed regardless of whether the call succeeds or fails). |
Success callback function
Property | Type | Description |
name | String | The location. |
address | String | The detailed address of the location. |
latitude | Number | The latitude that is expressed by a floating-point number. The value ranges from -90 to +90, and the negative number means south latitude. |
longitude | Number | The longitude that is expressed by a floating-point number. The value ranges from -180 to +180, and the negative number means west longitude. |
provinceName | String | The province. |
cityName | String | The city. |