# wx.openLocation(Object object)
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Check your location using WeChat's built-in map
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
latitude | number | yes | Latitude, range -9090. The negative number indicates latitude south. use gcj02 NBS coordinate system | |
longitude | number | yes | Longitude, range -180Negative numbers denote west longitude. use gcj02 NBS coordinate system | |
scale | number | 18 | no | Scale, Range 518 |
name | string | no | Location name | |
address | string | no | A detailed explaination of the address | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# sample code
wx.getLocation({
type: 'gcj02', //Returns the latitude and longitude that can be used for wx.openLocation
success (res) {
const latitude = res.latitude
const longitude = res.longitude
wx.openLocation({
latitude,
longitude,
scale: 18
})
}
})