PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > HBuilderX教程 > 正文

    uniapp读取通讯录

    作者:admin来源:网络浏览:时间:2021-06-06 11:34:13我要评论
    导读:uniapp读取通讯录
    uniapp读取通讯录

    1. getContacts: function() { 
    2.                 var that = this
    3.                 //获取通讯录对象 
    4.                 plus.contacts.getAddressBook( plus.contacts.ADDRESSBOOK_PHONE, function( addressbook ) { 
    5.                         uni.showToast({ 
    6.                             title: '获取通讯录对象成功'
    7.                             duration: 2000 
    8.                         }) 
    9.                         console.log('获取通讯录对象成功'
    10.                         console.log(addressbook) 
    11.                         // 查找联系人 
    12.                         addressbook.find(["displayName","phoneNumbers"],function(contacts){ 
    13.                             uni.showToast({ 
    14.                                 title: '获取联系人成功'
    15.                                 duration: 2000 
    16.                             }) 
    17.                             console.log('获取联系人成功'
    18.                             console.log(JSON.stringify(contacts)) 
    19.                             that.list = contacts 
    20.                         }, function () { 
    21.                             uni.showToast({ 
    22.                                 title: '获取联系人失败'
    23.                                 duration: 2000 
    24.                             }) 
    25.                         },{multiple:true}); 
    26.                     }, function ( e ) { 
    27.                         uni.showToast({ 
    28.                             title: '获取通讯录对象失败:' + e.message, 
    29.                             duration: 2000 
    30.                         }) 
    31.                     }); 
    32.             }, 

     

    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-146-6559-1.html
    相关热词搜索: uniapp读取通讯录