前端之家收集整理的这篇文章主要介绍了
微信小程序实现添加手机联系人功能示例,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_0@本文实例讲述了微信小程序实现添加手机联系人功能。分享给大家供大家参考,具体如下:
@H_
404_0@<span style="font-size: medium">
@H_
404_0@


@H_
404_0@

@H_
404_0@<span style="font-size: medium">
@H_
404_0@1)WXML
文件
<div class="jb51code">
<pre class="brush:xml;">
<view bindlongtap="phoneNumTap">{{phoneNum}}
函数
phoneNumTap:function(){
var that=this;
//
提示呼叫号码还是将号码
添加到手机通讯录
wx.showActionSheet({
itemList: ['呼叫','
添加联系人'],success:function(res){
if(res.tapIndex===0){
// 呼叫号码
wx.makePhoneCall({
phoneNumber: that.data.phoneNum,})
}else if(res.tapIndex==1){
//
添加到手机通讯录
wx.addPhoneContact({
firstName: 'test',//联系人姓名
mobilePhoneNumber: that.data.phoneNum,//联系人手机号
})
}
}
})
}
})