本篇内容主要讲解“微信小程序API收货地址怎么调起”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“微信小程序API收货地址怎么调起”吧!
wx.chooseAddress(OBJECT)
基础库版本 1.1.0 开始支持,低版本需做兼容处理
调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
OBJECT参数说明:
参数 |
类型 |
必填 |
返回 |
---|
success |
Function |
否 |
返回用户选择的收货地址信息 |
fail |
Function |
否 |
接口调用失败的回调函数 |
complete |
Function |
否 |
接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
参数 |
类型 |
说明 |
---|
errMsg |
String |
调用结果 |
userName |
String |
收货人姓名 |
postalCode |
String |
邮编 |
provinceName |
String |
国标收货地址第一级地址 |
cityName |
String |
国标收货地址第二级地址 |
countyName |
String |
国标收货地址第三级地址 |
detailInfo |
String |
详细收货地址信息 |
nationalCode |
String |
收货地址国家码 |
telNumber |
String |
收货人手机号码 |
示例代码:
wx.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)
}
})
Bug & Tip
tip
:wx.chooseAddress
接口需要用户授权,请兼容用户拒绝授权的场景。
到此,相信大家对“微信小程序API收货地址怎么调起”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!