title: Taro.chooseAddress(option)

sidebar_label: chooseAddress

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.

Reference

Type

  1. (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

  1. Taro.chooseAddress({
  2. success: function (res) {
  3. console.log(res.userName)
  4. console.log(res.postalCode)
  5. console.log(res.provinceName)
  6. console.log(res.cityName)
  7. console.log(res.countyName)
  8. console.log(res.detailInfo)
  9. console.log(res.nationalCode)
  10. console.log(res.telNumber)
  11. }
  12. })

API Support

API WeChat Mini-Program H5 React Native
Taro.chooseAddress ✔️