WeChat mini-app added mobile phone contact function example, mini-app example

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.