Taro.chooseAddress(option)
Gets the recipient address. This API opens the native UI for the user to edit the recipient address and returns to the selected address after the editing is completed.
Type
(option?: Option) => Promise<SuccessCallbackResult>
Parameters
Option
Property | Type | Required | Description |
---|---|---|---|
complete | (res: any) => void | No | The callback function used when the API call completed (always executed whether the call succeeds or fails) |
fail | (res: any) => void | No | The callback function for a failed API call |
success | (res: Result) => void | No | The callback function for a successful API call |
SuccessCallbackResult
Property | Type | Description |
---|---|---|
userName | string | Recipient name |
provinceName | string | Tier-1 address of national standard recipient address |
cityName | string | Tier-2 address of national standard recipient address |
countyName | string | Tier-3 address of national standard recipient address |
detailInfo | string | Detailed recipient address |
postalCode | string | Post code |
nationalCode | string | Country code of the recipient address |
telNumber | string | Mobile number of the recipient |
errMsg | string | Error message |
Sample Code
Taro.chooseAddress({
success: function (res) {
console.log(res.userName)
console.log(res.postalCode)
console.log(res.provinceName)
console.log(res.cityName)
console.log(res.countyName)
console.log(res.detailInfo)
console.log(res.nationalCode)
console.log(res.telNumber)
}
})
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.chooseAddress | ✔️ |