Back to Uni App

Add Phone Contact

docs/api/add-phone-contact.md

2.3.38.1 KB
Original Source
<!-- ## uni.addPhoneContact(options) @addphonecontact -->

::: sourceCode

uni.addPhoneContact(options) @addphonecontact

GitCode: https://gitcode.com/dcloud/uni-api/tree/alpha/uni_modules/uni-addPhoneContact

GitHub: https://github.com/dcloudio/uni-api/tree/alpha/uni_modules/uni-addPhoneContact

:::

手机通讯录联系人和联系方式的增加

addPhoneContact 兼容性

Web微信小程序AndroidiOSHarmonyOSHarmonyOS(Vapor)
<a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a>4.41<a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a><a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a>4.615.0

参数

名称类型必填默认值兼容性描述
optionsAddPhoneContactOptions-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -

options 的属性描述

名称类型必备默认值兼容性描述
photoFilePathstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -头像本地文件路径
nickNamestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -昵称
lastNamestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -姓氏
middleNamestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -中间名
firstNamestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -名字
remarkstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -备注
mobilePhoneNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -手机号
weChatNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -微信号
addressCountrystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -联系地址国家
addressStatestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -联系地址省份
addressCitystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -联系地址城市
addressStreetstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -联系地址街道
addressPostalCodestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -联系地址邮政编码
organizationstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -公司
titlestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -职位
workFaxNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作传真
workPhoneNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作电话
hostNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -公司电话
emailstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -电子邮件
urlstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -网站
workAddressCountrystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作地址国家
workAddressStatestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作地址省份
workAddressCitystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作地址城市
workAddressStreetstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作地址街道
workAddressPostalCodestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -工作地址邮政编码
homeFaxNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅传真
homePhoneNumberstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅电话
homeAddressCountrystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅地址国家
homeAddressStatestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅地址省份
homeAddressCitystring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅地址城市
homeAddressStreetstring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅地址街道
homeAddressPostalCodestring-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -住宅地址邮政编码
success(result: AddPhoneContactSuccess) => void-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -接口调用成功的回调函数
fail(result: AddPhoneContactFail) => void-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -接口调用失败的回调函数
complete(result: any) => void-Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: -接口调用结束的回调函数(调用成功、失败都会执行)

AddPhoneContactFail 的属性值 @addphonecontactfail-values

名称类型必备默认值兼容性描述
errSubjectstring-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -统一错误主题(模块)名称
errCodenumber-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -统一错误码
errMsgstring-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -统一错误描述信息
dataany-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -错误信息中包含的数据
causeError-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -源错误信息,可以包含多个错误,详见SourceError
namestring-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -
messagestring-Web: x; 微信小程序: -; Android: x; iOS: x; HarmonyOS: -
<!-- UTSAPIJSON.addPhoneContact.example -->

参见

<!-- UTSAPIJSON.addPhoneContact.example -->

通用类型

GeneralCallbackResult

名称类型必备默认值兼容性描述
errMsgstring-Web: -; 微信小程序: 4.41; Android: -; iOS: -; HarmonyOS: -错误信息