Example of how to add a mobile phone contact using a Applet
This example describes how to add a mobile phone contact using a applet. We will share this with you for your reference. The details are as follows:
1. Effect display
2. Key code
1) WXML File
<View bindlongtap = "phoneNumTap" >{{ phoneNum }}</view>
2) JS files
Page ({data: {phoneNum: '000000' // number used for testing, not a real number}, // long-pressed number response function phoneNumTap: function () {var that = this; // prompt whether to add the call number to the phone Address Book wx. showActionSheet ({itemList: ['call', 'add contact '], success: function (res) {if (res. tapIndex = 0) {// call number wx. makePhoneCall ({phoneNumber: that. data. phoneNum,})} else if (res. tapIndex = 1) {// Add it to the phone Address Book wx. addPhoneContact ({firstName: 'test', // mobilePhoneNumber: that. data. phoneNum, // mobile phone number of the contact })}}})}})
3) WXSS File
View {color: blue; padding: 15px; border-bottom: 1px solid gainsboro ;}
3. Complete instance codeClick hereDownload from this site.
I hope this article will help you develop small programs.